breaking long array in php code example
Example: breaking long array in php
To reverse an array_chunk, use array_merge, passing the chunks as a variadic:
<?php
$array = [1, 2, 3, 4, 5, 6, 7, 8, 9];
$chunks = array_chunk($array, 3);
// $chunks = [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
$de_chunked = array_merge(…$chunks);
// $de_chunked = [1, 2, 3, 4, 5, 6, 7, 8, 9]
?>