标签: php arrays
我有阵列:
$array = ('aaa', 4, 'fff', 2, 'ddd', 3, 'ddd', 32, '3243', 34, 'sdfs', 3);
我想这样做:
['aaa', 4], ['fff', 24], ['ddd', 3], ['ddd', 32], ['3243', 34] ['sdfs', 3] foreach($array as $i => $a){ //???? }
如何使用PHP进行此方法?
答案 0 :(得分:4)
array_chunk($array, 2);
http://php.net/manual/en/function.array-chunk.php