• PHP Video Tutorials

PHP - Ds Set first() Function



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

Syntax

public void Ds\Set::first( void )

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

Example 1

<?php 
   $set = new \Ds\Set(); 
   $set->add("10"); 
   $set->add("20"); 
   $set->add("30"); 
  
   print_r($set->first()); 
?>

Example 2

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