Change language

PHP Ds / Set merge () function

Syntax:
DsSet public DsSet::merge (mixed $values)
Parameters: this function takes one parameter $values,which contains elements.Return value:this function returns a set that adds all elements. The following programs illustrate the Ds / Set::merge()function in PHP:Program 1:  
// Create a new set $set = new DsSet ([12, 15, 18, 20]);  
// Merge the given element and display it var_dump ( $set -> merge ([1, 2 , 3]));  
// Show set item var_dump ( $set ) ?>
Exit:
object (DsSet ) # 2 (7) {[0] = > int (12) [1] = > int (15) [2] = > int (18) [3] = > int (20) [4] = > int (1) [5] = > int (2) [6] = > int (3)} object (DsSet) # 1 (4) {[0] = > int (12) [1] = > int (15) [2] = > int (18) [3] = > int (20)}
Program 2:  
// Create a new set $set = new DsSet ([12, 15 , 18, 20]);  
// Merge the given element and display it var_dump ( $set -> merge ([ "G" , "E" , " E " , " k " , "S" ]));  
?>
Exit:
object (DsSet ) # 2 (8) {[0] = > int (12) [1] = > int (15) [2] = > int (18) [3] = > int (20) [4] = > string (1) "G" [5] = > string (1) "E" [6] = > string (1) "k" [7] = > string (1) "S"}
Link: https://www.php.net/manual/en/ds-set.merge.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