I have the following array In php:
$values=[
[
['key'=>"Name",'value'=>"John"],
['key'=>'Surname','value'=>"Doe"],
['key'=>"email",'value'=>'john@doe.com']
],
[
['key'=>"Surname",'value'=>"Ichigo"],
['key'=>'Name','value'=>"Kurosaki"],
['key'=>'email','value'=>'kurosakiighogo@soulsociety.com']
],
[
['key'=>"email",'value'=>"monket.d@luffy.com"],
['key'=>'Name','value'=>"Monkey D."],
['key'=>'Surame','value'=>'Luffy']
],
];
And I want somehow to be generated as:
$values2=[
head=>['Name','Surname','email'],
values=>[
["John","Doe","john@doe.com"],
["Kurosaki","Ichigo","kurosakiighogo@soulsociety.com"],
['Monkey D.','Luffy','monket.d@luffy.com']
]
]
The key point I want is on head to be stored the keys and on values the values. But with the same Order.
To be specific on values[$i][$j] I want to be stored the $values['value'] where $values['key'] === head[j].
The problem is NOT HOW TO DISPLAY the array $values2 but HOW TO TRANSFORM $values array into $values2.
I want a bit of your help please.