PHP | Ds\Deque reversed() Function Last Updated : 14 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The Ds\Deque::reversed() function is an inbuilt function in PHP which is used to return the copy of Deque which contains the elements in reversed order. Syntax: public Ds\Deque::reversed( void ) : Ds\Deque Parameters: This function does not accept any parameter. Return Value: This function returns a Deque which is the copy of original Deque containing the elements in reverse order. Below programs illustrate the Ds\Deque::reversed() function in PHP: Program 1: PHP <?php // Declare a deque $deck = new \Ds\Deque([10, 20, 30, 40, 50, 60]); echo("Elements of Deque\n"); // Display the Deque elements var_dump($deck); // Reversing the deque $deck_new = $deck->reversed(); echo("\nElements of the reversed deque\n"); // Display the Deque elements var_dump($deck_new); ?> Output: Elements of Deque object(Ds\Deque)#1 (6) { [0]=> int(10) [1]=> int(20) [2]=> int(30) [3]=> int(40) [4]=> int(50) [5]=> int(60) } Elements of the reversed deque object(Ds\Deque)#2 (6) { [0]=> int(60) [1]=> int(50) [2]=> int(40) [3]=> int(30) [4]=> int(20) [5]=> int(10) } Program 2: PHP <?php // Declare a deque $deck = new \Ds\Deque(["geeks", "for", "geeks", "articles"]); echo("Elements of Deque\n"); // Display the Deque elements print_r($deck); // Reversing the deque $deck_new = $deck->reversed(); echo("\nElements of the reversed deque\n"); // Display the Deque elements print_r($deck_new); ?> Output: Elements of Deque Ds\Deque Object ( [0] => geeks [1] => for [2] => geeks [3] => articles ) Elements of the reversed deque Ds\Deque Object ( [0] => articles [1] => geeks [2] => for [3] => geeks ) Reference: http://php.net/manual/en/ds-deque.reversed.php Comment More infoAdvertise with us Next Article PHP | DsDeque reverse() Function B barykrg Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_deque Similar Reads PHP | DsDeque reversed() Function The Ds\Deque::reversed() function is an inbuilt function in PHP which is used to return the copy of Deque which contains the elements in reversed order. Syntax: public Ds\Deque::reversed( void ) : Ds\Deque Parameters: This function does not accept any parameter. Return Value: This function returns a 2 min read PHP | DsDeque reverse() Function The Ds\Deque::reverse() function is an inbuilt function in PHP which is used to reverse the elements in the Deque in-place. Syntax: public Ds\Deque::reverse( void ) : void Parameters: This function does not accept any parameter. Return Value: This function does not return any value. Below programs i 2 min read PHP | DsSequence reversed() Function The Ds\Sequence::reversed() function is an inbuilt function in PHP which is used to return the reverse copy of sequence element. Syntax: Ds\Sequence abstract public Ds\Sequence::reversed ( void ) Parameters: This function does not accepts any parameter. Return Value: This function returns the revers 2 min read PHP | DsSequence reverse() Function 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 2 min read PHP DsSet reversed() Function The Ds\Set::reversed() function of Ds\Set class in PHP is an inbuilt function which is used to create a copy of the original Set with values arranged in reverse order. That is, this function returns a reversed copy of the actual set. This function does not affect the original set instance. Syntax: D 2 min read PHP | DsMap reverse() Function The Ds/Map::reverse() function in PHP is used to in-place reverse the elements of a specified Map instance. That is, the function in-place reverses the order of elements present in the specified Map instance. Syntax: Ds\Map public Ds\Map::reverse ( int $position ) Parameter: This function does not a 2 min read Like