• PHP Video Tutorials

PHP - Ds Vector reverse() Function



Ds\Vector::reverse() function can reverse the vector in-place.

Syntax

public void Ds\Vector::reverse ( void )

Ds\Vector::reverse() function doesn't have any parameters.

Ds\Vector::reverse() function doesn't return any value.

Example 1

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

Example-2

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