Ds\Map::last

(PECL ds >= 1.0.0)

Ds\Map::lastReturns the last pair of the map

Beschreibung

publicDs\Map::last(): Ds\Pair

Returns the last pair of the map.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

The last pair of the map.

Fehler/Exceptions

UnderflowException if empty.

Beispiele

Beispiel #1 Ds\Map::last() example

<?php
$map
= new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
var_dump($map->last());
?>

Das oben gezeigte Beispiel erzeugt eine ähnliche Ausgabe wie:

object(Ds\Pair)#2 (2) { ["key"]=> string(1) "c" ["value"]=> int(3) }
To Top