How to write an array into a multidimensional array through loop?

I have an array where the odd elements are dates, and the even elements are messages, I need this array to make multidimensional, which would be arrays containing the fields date and text, like this:
Array
(
 [0] => Array
(
 [date] => 01.09.2016
 [sum] => 450
)

 [1] => Array
(
 [date] => 31.08.2016
 [sum] => 156
)

 [2] => Array
(
 [date] => 02.09.2016
 [sum] => 888
)

)
March 12th 20 at 08:06
1 answer
March 12th 20 at 08:08
Solution
array_map(function($n) {
 return [
 'date' => $n[0],
 'sum' => $n[1]
];
}, array_chunk($arr, 2))
Thank you - norval.Walsh commented on March 12th 20 at 08:11

Find more questions by tags PHP