• PHP Video Tutorials

PHP - Ds Set last() Function



Ds\Set::last() function can return the last value in a set.

Syntax

public void Ds\Set::last( void )

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

Ds\Set::last() function can return the last value in a set. This function can throw UnderflowException if empty.

Example 1

<?php 
   $set = new \Ds\Set(); 
   $set->add("25"); 
   $set->add("50"); 
   $set->add("75"); 
   $set->add("100"); 

   print_r($set->last()); 
?>

Example 2

<?php 
   $set = new \Ds\Set(); 
   $set->add("Tutorials"); 
   $set->add("Point"); 
   $set->add("India"); 
  
   print_r($set->last()); 
?>
php_function_reference.htm
Advertisements