The Ds\Map::first() function of PHP Ds\Map class is used to get the first key-value pair from the Map instance.
Ds\Pair public Ds\Map::first ( )
Parameters: This function does not accepts any parameter.
Return value: It returns a pair of type Ds\Pair which is the first key-value pair from the Map instance. That is the key-value pair present at the front of the Map instance.
Below programs illustrate the Ds\Map::first() function in PHP:
Ds\Pair Object ( [key] => 1 [value] => Geeks )
Ds\Pair Object ( [key] => first [value] => Geeks )
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.