3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arr1 = array ( '0' => array ('fid' => 1, 'tid' => 1, 'name' => 'Name1' ), '1' => array ('fid' => 1, 'tid' => 2 , 'name' => 'Name2' ), '2' => array ('fid' => 1, 'tid' => 5 , 'name' => 'Name3' ), '3' => array ('fid' => 1, 'tid' => 7 , 'name' => 'Name4' ), '4' => array ('fid' => 3, 'tid' => 9, 'name' => 'Name5' ) ); $arr2 = array_chunk($arr1,4); print_r($arr2);
Output for 4.3.0 - 5.6.25, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Array ( [0] => Array ( [fid] => 1 [tid] => 1 [name] => Name1 ) [1] => Array ( [fid] => 1 [tid] => 2 [name] => Name2 ) [2] => Array ( [fid] => 1 [tid] => 5 [name] => Name3 ) [3] => Array ( [fid] => 1 [tid] => 7 [name] => Name4 ) ) [1] => Array ( [0] => Array ( [fid] => 3 [tid] => 9 [name] => Name5 ) ) )