Skip to content

Instantly share code, notes, and snippets.

@elvismdev
Last active June 16, 2017 05:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elvismdev/2566038f71370b2b78de15688e7e5e31 to your computer and use it in GitHub Desktop.
Save elvismdev/2566038f71370b2b78de15688e7e5e31 to your computer and use it in GitHub Desktop.
De-chunks an array, opposite of array_chunk() http://php.net/manual/en/function.array-chunk.php
function array_dechunk( $array ) {
return array_reduce( $array, function ( $carry, $item ) {
return array_merge( $carry, $item );
}, [] );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment