Suppose I have this multidimensional array:
Array(
[0] => Array
(
[0] => 08/Mar/2004
[1] => apple
)
[1] => Array
(
[0] => 08/Mar/2004
[1] => orange
)
[2] => Array
(
[0] => 09/Mar/2004
[1] => mango
)
[3] => Array
(
[0] => 09/Mar/2004
[1] => grape
)
[4] => Array
(
[0] => 10/Mar/2004
[1] => apple
)
[5] => Array
(
[0] => 10/Mar/2004
[1] => kiwi
)
)
The dates present in the array are unknown, meaning that the array can have other date such as 11/Mar/2004 and 12/Mar/2004 and so on at each first position of the sub array.
An array should be dynamically created for every different date present.
I want to retrieve all the value at index 1 from the sub arrays for all the common dates and save the values in the newly created array for the corresponding date.
I want the result to be as follows:
Array(
[0] => 08/Mar/2004
[1] => apple
[2] => orange
)
Array(
[0] => 09/Mar/2004
[1] => mango
[2] => grape
)
Array(
[0] => 10/Mar/2004
[1] => apple
[2] => kiwi
)
Any help would be much appreciated.