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