Wallogit.com
2017 © Pedro Peláez
Provides a consolidated polyfill for array_key_first(), array_key_last(), and the unapproved functions array_value_first() and array_value_last().
Provides a consolidated polyfill for
array_key_first(),array_key_last(), and the unapproved functionsarray_value_first()andarray_value_last()., (*1)
This package is available via Packagist:, (*2)
composer require p810/array-fl
You can also download it directly from GitHub. Latest stable tag: 1.2.0, (*3)
array_first(array $array): null|arrayReturns a tuple containing the key and value of the first item in $array.
If $array is not an array or is empty, null is returned., (*4)
array_last(array $array): null|arrayReturns a tuple containing the key and value of the last item in $array.
If $array is not an array or is empty, null is returned., (*5)
array_key_first(array $array): null|int|stringReturns the key of the first item in $array.
If $array is not an array or is empty, null is returned., (*6)
array_key_last(array $array): null|int|stringReturns the key of the last item in $array.
If $array is not an array or is empty, null is returned., (*7)
array_value_first(array $array): null|mixedReturns the value of the first item in $array.
If $array is not an array or is empty, null is returned., (*8)
array_value_last(array $array): null|mixedReturns the value of the last item in $array.
If $array is not an array or is empty, null is returned., (*9)
Run composer run test to run a set of unit tests for these functions.
No external dependency (e.g. PHPUnit) is required., (*10)