The array_chunk() function splits an array into chunks of new arrays.
Syntax:array_chunk(array,size,preserve_key);
In above syntax, "array" specifies the array to use, "size" is an integer that specifies the size of each chunk and "preserve_key" preserve_key values are as follows:
<?php
$fruit_weight=array("Apple"=>"5kg","Banana"=>"7kg","Mango"=>"10kg");
print_r(array_chunk($fruit_weight,2));
?>
Output:
Others
Languages
Frameworks
Web / Design
Mobile Technology
Sql & Technology
R4R