arrayutils
Search
K

pop()

The pop() method removes the last element and returns that element
Example.php
<?php use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(["Apple", "Banana", "Carrot"]);
//Gets last value
$arrayUtils->pop();
// expected output: "Carrot"
$arrayUtils;
// expected output: ["Apple", "Banana"]

Syntax

$arrayUtils->pop() : mixed;

Return value

  • The last value of array.

Prefixing

ArrayUtils::pop() : mixed;

References

Last modified 2yr ago