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

Ds\Map::first

(PECL ds >= 1.0.0)

Ds\Map::firstReturns the first pair in the map

Açıklama

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

Returns the first pair in the map.

Bağımsız Değişkenler

Bu işlevin bağımsız değişkeni yoktur.

Dönen Değerler

The first pair in the map.

Hatalar/İstisnalar

UnderflowException if empty.

Örnekler

Örnek 1 Ds\Map::first() example

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

Yukarıdaki örnek şuna benzer bir çıktı üretir:

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