This function takes an existing array and breaks it up into two or more arrays. Syntax: array(array, array size, true/false) The array signifies the array you wish to use. The size is the number of elements that the new arrays will have. The true/false value is technically known as the preserve_key. It is optional and basically dictates whether or not the keys from the originating array are "preserved" or not. Programming Samples and Usage:
$test = array ("a" => "Superman", "b" => "Batman", "c" => "Sandman"); print_r(array_chunk($test,3)); ?>
The above code would result in:
array ( You can also choose to preserve the original array keys, by coding the following:
<?php $test = array ("a" => "Superman", "b" => "Batman", "c" => "Sandman"); print_r(array_chunk($test,3,true)); ?>
Which would result in:
array (
blog comments powered by Disqus |
|
|
|
|
|
|
|