Change language

PHP Ds / Deque __construct () Function

Syntax:
DsDeque::__ construct ($values) 
Parameters:This function takes one parameter $values,which contains a float or array to use for initial values.The following programs illustrate the Ds / Deque::__ construct()function in PHP: Program 1:  
// Declare deque $deq = new DsDeque();  
// Show deque elements echo ( "Elements of first deque:" ); var_dump ( $deq );  
// Declare deque $deq = new DsDeque ([10, 20, 30, 40, 50, 60]);  
// Show deque elements echo ( "Elements of second deque:" ); var_dump ( $deq );  
?>
Exit:
Elements of first deque: object (DsDeque) # 1 (0) {} Elements of second deque: object (DsDeque) # 2 (6) {[0] = > int (10) [1] = > int (20) [2] = > int (30) [3] = > int (40) [4] = > int (50) [5] = > int (60)} 
Program 2:  
// Declare deque $deq = new DsDeque ([ "engineer" , "for" , "engineer" ]);  
// Show deque elements echo ( "Elements of first deque:" ); print_r ( $deq );  
// Declare deque $deq = new DsDeque ([ ’G’ , ’ E’ , ’E’ , ’ K ’ , ’ S’ , 1, 2, 3]);  
// Show deque elements echo ( "Elements of second deque:" ); print_r ( $deq );  
?>
Exit:
Elements of first deque: DsDeque Object ([0] = > engineer [1] = > for [2] = > engineer) Elements of second deque: DsDeque Object ([0] = > G [1] = > E [ 2] = > E [3] = > K [4] = > S [5] = > 1 [6] = > 2 [7] = > 3) 
Link: https://www.php.net/manual/en/ds- deque.construct.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