Search

Showing 7 of 1,216 result(s)

/blog/2018/04/11/laravel-5-adding-a-new-element-to-the-beginning-of-an-array-with-prepend#content-global-arrayprepend-helper-function

The array_prepend helper function is a shortcut to calling the Arr::prepend helper method. This function is declared in the global namespace.

/blog/2018/04/11/laravel-5-adding-elements-to-the-array-with-add#content-global-arrayadd-helper-function

The array_add function is a shortcut to calling Arr::add . This function is declared in the global namespace.

/blog/2018/04/11/laravel-5-adding-or-setting-new-array-element-values-with-set#content-example-use

The set method also uses dot notation for its $key value. We will use the set function to create a simple array: Which would produce a familiar looking array: Overwriting the value of first_name is also easy to accomplish: The $testArray would now...

/blog/2018/04/11/laravel-5-adding-or-setting-new-array-element-values-with-set#content-using-set-to-change-the-entire-array

The set function can be used to change the entire value of the array. This is accomplished by passing null as the value for $key . When null is used for the $key , the $value will be assigned to the $array variable. The effects of this can be...