Change language

PHP Ds / Deque unshift () Function

Syntax:
void DsDeque::unshift ($values)
Parameters: This function takes one parameter, $values,which contains the values ​​to add to the deque font.Return value:This function does not return any values. The following programs illustrate the Ds / Deque::unshift()function in PHP:Program 1:  
// Declare deque $deq = new DsDeque ([10, 20, 30, 40]);  
// Use the function Ds / Deque::unshift() $deq -> unshift (5); $deq -> unshift (7); $deq -> unshift (8); print_r ( $deq );  
?>
Exit:
DsDeque Object ( [0] = > 8 [1] = > 7 [2] = > 5 [3] = > 10 [4] = > 20 [5] = > 30 [6] = > 40)
Program 2:  
// Declare deque $deq = new DsDeque();  
// Use the function Ds / Deque::unshift() $deq -> unshift ( "Welcome" ); $deq -> unshift ( "to" ); $deq -> unshift ( "GeeksforGeeks" ); var_dump ( $deq );  
// Declare another deck $deq = new DsDeque ([ ’G’ , ’ E’ , ’E’ , ’K’ , ’ S’ ]);  
// Use the function Ds / Deque::unshift() $deq -> unshift ( "1" ); $deq -> unshift ( "2" ); $deq -> unshift ( "3" ); var_dump ( $deq );  
?>
Exit:
object (DsDeque ) # 1 (3) {[0] = > string (13) "GeeksforGeeks" [1] = > string (2) "to" [2] = > string (7) "Welcome"} object (DsDeque) # 2 (8) {[0] = > string (1) "3" [1] = > string (1) "2" [2] = > string (1) "1" [3] = > string (1) "G" [4] = > string (1) "E" [5] = > string (1) "E" [6] = > string (1) "K" [7] = > string (1) "S"}
Link: https://www.php.net/manual/en/ds-deque.unshift.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method