• PHP Video Tutorials

PHP - Ds Vector reversed() Function



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

Syntax

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

Ds\Vector::reversed() function doesn't have any parameters. This function can return a reversed copy of the vector.

Example 1

<?php 
   $array = new \Ds\Vector([1, 2, 3, 4, 5]); 
   var_dump($array); 
   
   echo("The vector after reversing: \n"); 
   var_dump($array->reversed()); 
?>

Example 2

<?php 
   $array= new \Ds\Vector(["Tutorials", "Point", "Tutorix"]); 
   print_r($array); 
  
   echo("The vector after reversing: \n"); 
   print_r($array->reversed()); 
?>
php_function_reference.htm
Advertisements