arrayutils
Search…
⌃K

keyLast()

The keyLast() method returns last key
Example.php
<?php use kim\present\utils\arrays\ArrayUtils;
​
$arrayUtils = ArrayUtils::from(["Apple" => 0, "Banana" => 1, "Carrot" => 2]);
​
//Gets last key
$arrayUtils->keyLast();
// expected output: "Carrot"

Syntax

$arrayUtils->keyLast() : int|string|null;

Return value

  • A last key of array. If array is empty, returns NULL.

Prefixing

ArrayUtils::keyLastFrom(iterable $from) : int|string|null;

References

Last modified 2yr ago