This site is mobile accessible. Press the "Tap Here" button to use a different font-size.


Smartphone icons created by Freepik - Flaticon

PHP Arrays

array_chunk() Function

Array ( [0] => Array ( [Peter] => 35 [Ben] => 37 ) [1] => Array ( [Joe] => 43 [Harry] => 50 ) )

<?php
// associative array to be split into 2 chunks
$age=array("Peter"=>"35","Ben"=>"37","Joe"=>"43","Harry"=>"50");

// split $age into 2 chunks while preserving the keys then display the results
print_r(array_chunk($age,2,true));
?>