array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'fr', ), 'this' => array ( 0 => 'ds-map.first.php', 1 => 'Ds\\Map::first', ), 'up' => array ( 0 => 'class.ds-map.php', 1 => 'Ds\\Map', ), 'prev' => array ( 0 => 'ds-map.filter.php', 1 => 'Ds\\Map::filter', ), 'next' => array ( 0 => 'ds-map.get.php', 1 => 'Ds\\Map::get', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/ds/ds/map/first.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PECL ds >= 1.0.0)
Ds\Map::first — Returns the first pair in the map
Cette fonction ne contient aucun paramètre.
The first pair in the map.
UnderflowException if empty.
Exemple #1 Ds\Map::first() example
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
var_dump($map->first());
?>
Résultat de l'exemple ci-dessus est similaire à :
object(Ds\Pair)#2 (2) { ["key"]=> string(1) "a" ["value"]=> int(1) }