I have this multidimensional array:
array {
[0]=>
array(2) {
[“foo”]=>
int(138)
[“bar”]=>
int(127)
}
[1]=>
array(2) {
[“foo”]=>
int(138)
[“bar”]=>
int(47)
}
[2]=>
array(2) {
[“foo”]=>
int(138)
[“bar”]=>
int(13)
}
[3]=>
array(2) {
[“foo”]=>
int(138)
[“bar”]=>
int(56)
}
[4]=>
array(2) {
[“foo”]=>
int(154)
[“bar”]=>
int(77)
}
[5]=>
array(2) {
[“foo”]=>
int(154)
[“bar”]=>
int(69)
}
[6]=>
array(2) {
[“foo”]=>
int(154)
[“bar”]=>
int(70)
}
[7]=>
array(2) {
[“foo”]=>
int(154)
[“bar”]=>
int(75)
For every value of foo that's the same, I want to create a new array with 'foo' being the $key and each of its corresponding 'bar' values in that array (i.e:
array[138] {
127
47
13
56
}
Any help would be awesome. Thank you.