Arr::collapse

Posted on November 14, 2016

The Arr::collapse function collapses an array of arrays into a single array:

Example usage

$array = Arr::collapse([[1, 2, 3], [4, 5, 6], [7, 8, 9]]);

// [1, 2, 3, 4, 5, 6, 7, 8, 9]

$array = Arr::collapse([
    ['id' => 1, 'name' => 'John Doe'],
    ['id' => 2, 'name' => 'Jane Doe'],
]);

// ['id' => 2, 'name' => 'Jane Doe']

Parameters

array $array

Return Value

Array

0 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *