array_last
Gets the last value of an array
Description
mixed array_last(array $array
)
Parameters
-
array
-
An array.
Return Values
Returns the last value of array
if the array is not empty;
null
otherwise.
Examples
Example #1 Basic array_last Usage
<?php
$array = [1 => 'a', 0 => 'b', 3 => 'c', 2 => 'd'];
$lastValue = array_last($array);
var_dump($lastValue);
?>
The above example will output:
See Also
- array_key_last
- array_first