Arr::prepend

Posted on November 16, 2016

The Arr::prepend function will push an item onto the beginning of an array.

Example usage

$array = ['one', 'two', 'three', 'four'];

$array = Arr::prepend($array, 'zero');

// $array: ['zero', 'one', 'two', 'three', 'four']

Parameters

array $array

mixed $value

mixed $key

Return Value

array

0 Comments

Leave a Reply

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