I have an array with 3200 values. A user chooses a number (let's say 50). I want to divide the big array into smaller arrays, each of them containing 50 values (the last one containing the remainder).
How would you do that?
array_chunk
e.g.
$arrays = array_chunk($my_big_array, 50);
array array_chunk ( array $input , int $size [, bool $preserve_keys = false ] )
Check this: http://php.net/manual/en/function.array-chunk.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With