PHP.nl

array_last

array_last

Gets the last value of an array

mixed **array_last** array $array

Get the last value of the given . array

arrayAn array.

Returns the last value of if the array is not empty; null otherwise. array

Voorbeeld: Basic Usage

<?php
$array = [1 => 'a', 0 => 'b', 3 => 'c', 2 => 'd'];

$lastValue = array_last($array);

var_dump($lastValue);
?>
string(1) "d"

array_key_last``array_first