Topic View
#Arrays.
2 posts filed under this topic.
PHP 5 min read
Get the Last Element of an Array in PHP and Laravel
Five ways to get the last element of a PHP array: Arr::last(), last() helper, end(), array_slice(), and Eloquent collection ->last(). With side-effect warnings.
Vishnu
Laravel 5 min read
Laravel Arr::flatten(): Flatten Nested Arrays
How to flatten multi-dimensional PHP arrays with Laravel's Arr::flatten(). Covers the depth parameter, key discard behavior, and comparison with plain PHP.
Vishnu