array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'uk', ), 'this' => array ( 0 => 'ds-map.last.php', 1 => 'Ds\\Map::last', 2 => 'Returns the last pair of the map', ), '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', ), 'history' => array ( ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); contributors($setup); ?>

Ds\Map::last

(PECL ds >= 1.0.0)

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

Опис

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

Returns the last pair of the map.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

The last pair of the map.

Помилки/виключення

UnderflowException if empty.

Приклади

Приклад #1 Ds\Map::last() example

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

Поданий вище приклад виведе щось схоже на:

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