Reputation: 63
i have array:
$array = ('aaa', 4, 'fff', 2, 'ddd', 3, 'ddd', 32, '3243', 34, 'sdfs', 3);
i woulde like make this:
['aaa', 4],
['fff', 24],
['ddd', 3],
['ddd', 32],
['3243', 34]
['sdfs', 3]
foreach($array as $i => $a){
//????
}
how is the method for this with PHP?
Upvotes: 0
Views: 73
Reputation: 60536
array_chunk($array, 2);
http://php.net/manual/en/function.array-chunk.php
Upvotes: 4