Ds\Map::last

(PECL ds >= 1.0.0)

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

Descripción

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

Returns the last pair of the map.

Parámetros

Esta función no tiene parámetros.

Valores devueltos

The last pair of the map.

Errores/Excepciones

UnderflowException if empty.

Ejemplos

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

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

El resultado del ejemplo sería algo similar a:

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