• PHP Video Tutorials

PHP - Ds Set get() Function



Ds\Set::get() function can return the value at a given index.

Syntax

public mixed Ds\Set::get( int $index )

Ds\Set::get() function can return the value at the requested index.

Ds\Set::get() function can throw OutOfRangeException if an index is not valid.

Example 1

<?php  
   $set = new \Ds\Set([10, 15, 20, 25, 30]);  
   var_dump($set);  
  
   echo "The value at index 3:"; 
   print_r($set->get(3)); 
?> 

Example 2

<?php  
   $set = new \Ds\Set(["Tutorials", "Point", "India"]);  
   var_dump($set);  
  
   echo "The value at index 1:"; 
   print_r($set->get(1)); 
?> 
php_function_reference.htm
Advertisements