Ds\Map::first
PHP function
Edit on GitHub ✎
(PECL ds >= 1.0.0)
Returns the first pair in the map
Description
Ds\Map::first(): Ds\Pair
Returns the first pair in the map.
Parameters Parameters
Return Values
The first pair in the map.
Errors/Exceptions
UnderflowException if empty.
Examples
Ds\Map::first() example
php
<?php
$map = new \Ds\Map(["a" => 1, "b" => 2, "c" => 3]);
var_dump($map->first());
?>The above example will output something similar to:
output
object(Ds\Pair)#2 (2) {
["key"]=>
string(1) "a"
["value"]=>
int(1)
}