array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'en', ), 'this' => array ( 0 => 'ds-map.last.php', 1 => 'Ds\\Map::last', ), 'up' => array ( 0 => 'class.ds-map.php', 1 => 'Ds\\Map', ), 'prev' => array ( 0 => 'ds-map.ksorted.php', 1 => 'Ds\\Map::ksorted', ), 'next' => array ( 0 => 'ds-map.map.php', 1 => 'Ds\\Map::map', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/map/last.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL ds >= 1.0.0)
Ds\Map::last — Returns the last pair of the map
This function has no parameters.
The last pair of the map.
UnderflowException if empty.
Example #1 Ds\Map::last() example
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
var_dump($map->last());
?>
The above example will output something similar to:
object(Ds\Pair)#2 (2) { ["key"]=> string(1) "c" ["value"]=> int(3) }