array_chunk function - how to splits an array into chunks of new arrays in php

array_chunk function - how to splits an array into chunks of new arrays in php


array_chunkfunction.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>array_chunk function - how to splits an array into chunks of new arrays in php</title>
</head>

<body>
    <h2 style="color:Navy; font-style:italic">php example: using array_chunk function in php</h2>
    <hr width="525" align="left" color="DodgerBlue" />
    <br />

<?php 
 $Colors=array("Crimson","Snow","DodgerBlue","BurlyWood","SaddleBrown");
 print_r(array_chunk($Colors,2,true));
 echo "<br /><br />";
 print_r(array_chunk($Colors,2,false));
?>

</body>
</html>