Search

Showing 7 of 1,216 result(s)

/blog/2018/04/11/laravel-5-finding-the-last-occurrence-of-an-element-matching-a-condition-with-last#content-optional-callback-parameter

The $callback function is an optional parameter, and can be omitted. When the $callback parameter is omitted, the last method will return the last item in the array:

/blog/2018/04/11/laravel-5-removing-elements-from-an-array-with-forget#content-example-use

Assuming an array is defined as follows: We could remove the first_name value like so: Which would leave the array as follows: Removing multiple items at once is as simple as passing an array as the second argument: