diff --git a/functions/array.xml b/functions/array.xml index e4777f14bc..0458b692e4 100644 --- a/functions/array.xml +++ b/functions/array.xml @@ -1,5 +1,5 @@ - + Array Functions Arrays @@ -134,6 +134,56 @@ Array + + + array_chunk + Split an array into chunks + + + Description + + + array array_chunk + array input + int size + bool preserve_keys + + + + array_chunk splits the array into + several arrays with size values + in them. You may also have an array with less values + at the end. You get the arrays as members of a + multidimensional array indexed with numbers starting + from zero. + + + By setting the optional preserve_keys + parameter to &true;, you can force PHP to preserve the original + keys from the input array. If you specify &false; new number + indicies will be used in each resulting array with + indices starting from zero. The default is &false;. + + + + <function>array_chunk</function> example + +$input_array = array('a', 'b', 'c', 'd', 'e'); +$output_array = array_chunk($input_array, 2); +/* + the structure of $output_array will be: + array( + array('a', 'b'), + array('c', 'd'), + array('e') + ) +*/ + + + + + + array_count_values