• PHP Video Tutorials

PHP - Ds Set reversed() Function



Ds\Set::reversed() function can return a reversed copy.

Syntax

public Ds\Set Ds\Set::reversed( void )

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

Ds\Set::reversed() function can return a reversed copy of a set.

Example 1

<?php  
   $set = new \Ds\Set([1, 2, 3, 4, 5]); 
   echo "\n The actual set is: \n"; 
   print_r($set); 
  
   echo("The reversed set is: \n");  
   print_r($set->reversed());  
?>

Example-2

<?php  
   $set = new \Ds\Set(["Tutorials", "Point", "India"]); 
   echo "\n The actual set is: \n"; 
   print_r($set); 
  
   echo("The reversed set is: \n");  
   print_r($set->reversed());  
?>  
php_function_reference.htm
Advertisements