PHP Ds / Deque reverse () function

Syntax:
public DsDeque::reverse (void): void
Parameters: this function takes no parameters.Returned value:this function does not return any value.The following programs illustrate the Ds / Deque function::reverse()in PHP:Program 1:  
// Declare deque $deck = new DsDeque ([10, 20, 30, 40, 50, 60]); echo ( " Elements of Deque " );  
// Show Deque elements var_dump ( $deck );  
// Reverse $deck -> reverse(); echo ( " Elements of the reversed deque " );  
// Show Deque elements var_dump ( $deck );  
?>
Exit:
Elements of Deque object (DsDeque) # 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 (DsDeque) # 1 (6) {[0] = > int (60) [1] = > int (50) [2] = > int (40) [3] = > int (30) [4] = > int (20) [5] = > int (10)}
Program 2:  
// Declare deque $deck = new DsDeque ([ "engineer" , "GFG" , "ABC" ]); echo ( " Elements of Deque " );  
// Show Deque elements print_r ( $deck );  
// Reverse $deck -> reverse(); echo ( " Elements of the reversed deque " );  
// Show Deque elements print_r ( $deck );  
?>
Exit:
Elements of Deque DsDeque Object ([0] = > engineer [1] = > GFG [2] = > ABC) Elements of the reversed deque DsDeque Object ([0] = > ABC [1] = > GFG [2] = > engineer)
Link: http: // php .net / manual / en / ds-deque.reverse.php



Get Solution for free from DataCamp guru