Change language

PHP Ds / Pair copy () function

Syntax:
DsPair DsPair::copy (void)
Parameters:this function takes no parameters.Return value:this function returns a shallow copy of the pair element.The following programs illustrate the Ds / Pair::copy ( ) in PHP:Program 1:  
// Create new pair $pair = new DsPair ( "G" , "GeeksforGeeks" );  
// Show pair element print_r ( $pair );  
// Using the copy() function $pair -> copy (); echo " Copied pair elements: " ;  
// Show pair element print_r ( $pair );  
?>
Exit:
DsPair Object ( [key] = > G [value] = > GeeksforGeeks) Copied pair elements: DsPair Object ([key] = > G [value] = > GeeksforGeeks)
Program 2:  
// Create a new pair $pair = new DsPair ([ "G" , "GeeksforGeeks" ], [1, 2]);  
// Show pair element var_dump ( $pair );  
// Using the copy() function $pair -> copy (); echo " Copied pair elements: " ;  
// Show pair element var_dump ( $pair );  
?>
Exit:
object (DsPair ) # 1 (2) {["key"] = > array (2) {[0] = > string (1) "G" [1] = > string (13) "GeeksforGeeks"} ["value"] = > array (2) {[0] = > int (1) [1] = > int (2)}} Copied pair elements: object (DsPair) # 1 (2) {["key"] = > array (2) {[0] = > string (1) "G" [1] = > string (13) "GeeksforGeeks"} ["value"] = > array (2) {[0] = > int (1) [1] = > int (2)}}
Link: https://www.php.net/manual/en/ds-pair.copy.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