last()
The last() method returns last value
<?php use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(["Apple", "Banana", "Carrot"]);
//Gets last value
$arrayUtils->last();
// expected output: "Carrot"
Syntax
$arrayUtils->last() : mixed;
Return value
A last value of array. If array is empty, returns
NULL
.
Prefixing
ArrayUtils::lastFrom(iterable $from) : mixed;
Last updated