PHP | Ds\Sequence reverse() Function Last Updated : 22 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The Ds\Sequence::reverse() function is an inbuilt function in PHP which is used to reverse the sequence in-place. Syntax: void abstract public Ds\Sequence::reverse ( void ) Parameters: This function does not accepts any parameter. Return value: This function does not return any value. Below programs illustrate the Ds\Sequence::reverse() function in PHP: Program 1: php <?php // Create new Vector $seq = new \Ds\Vector([1, 2, 3, 4, 5]); // Display the elements print_r($seq); echo("Sequence after reversing\n"); // Use reverse() function to reverse // the element and display it $seq->reverse(); print_r($seq); ?> Output: Ds\Vector Object ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 ) Sequence after reversing Ds\Vector Object ( [0] => 5 [1] => 4 [2] => 3 [3] => 2 [4] => 1 ) Program 2: php <?php // Create new Vector $seq = new \Ds\Vector(["Geeks", "for", "Geeks", "Computer", "Science", "Portal"]); // Display the elements print_r($seq); echo("Sequence after reversing\n"); // Use reverse() function to reverse // the element and display it $seq->reverse(); print_r($seq); ?> Output: Ds\Vector Object ( [0] => Geeks [1] => for [2] => Geeks [3] => Computer [4] => Science [5] => Portal ) Sequence after reversing Ds\Vector Object ( [0] => Portal [1] => Science [2] => Computer [3] => Geeks [4] => for [5] => Geeks ) Reference: https://www.php.net/manual/en/ds-sequence.reverse.php Create Quiz Comment R R_Raj Follow 0 Improve R R_Raj Follow 0 Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_sequence Explore BasicsPHP Syntax4 min readPHP Variables5 min readPHP | Functions6 min readPHP Loops4 min readArrayPHP Arrays5 min readPHP Associative Arrays4 min readMultidimensional arrays in PHP5 min readSorting Arrays in PHP4 min readOOPs & InterfacesPHP Classes2 min readPHP | Constructors and Destructors5 min readPHP Access Modifiers4 min readMultiple Inheritance in PHP4 min readMySQL DatabasePHP | MySQL Database Introduction4 min readPHP Database connection2 min readPHP | MySQL ( Creating Database )3 min readPHP | MySQL ( Creating Table )3 min readPHP AdvancePHP Superglobals6 min readPHP | Regular Expressions12 min readPHP Form Handling4 min readPHP File Handling4 min readPHP | Uploading File3 min readPHP Cookies9 min readPHP | Sessions7 min read Like