• PHP Video Tutorials

PHP - Ds Map last() Function



Ds\Map::last() function can return the last pair of a map.

Syntax

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

Ds\Map::last() function doesn't have any parameters.

Ds\Map::last() function can return the last pair of a map. This function can throw UnderflowException if empty.

Example 1

<?php 
   $map = new \Ds\Map(["1" => "10", "2" => "20", "3" => "30"]); 
   print_r($map->last());   
?>

Example 2

<?php 
   $map = new \Ds\Map(["1" => "Tutorials", "2" => "Point", "3" => "India"]); 
   print_r($map->last()); 
?>
php_function_reference.htm
Advertisements