Here is the example array :
Array
(
[0] => Array
(
[action] => move
[para1] => h_1
[para2] => loc_231
[day] => day_1
)
[1] => Array
(
[action] => visit
[para1] => poi_231
[para2] => loc_231
[day] => day_1
)
[2] => Array
(
[action] => visit
[para1] => poi_231
[para2] => loc_231
[day] => day_2
)
)
I would like to split the array based on the value of key day and then combine them together.
The final array should look like:
Array
(
Array(
[0] => Array
(
[action] => move
[para1] => h_1
[para2] => loc_231
[day] => day_1
)
[1] => Array
(
[action] => visit
[para1] => poi_231
[para2] => loc_231
[day] => day_1
)
)
Array(
[0] => Array
(
[action] => visit
[para1] => poi_231
[para2] => loc_231
[day] => day_2
)
)
)
What is the better way other than iterating through the array? Is there any php function for that ?