PHP | Ds\Set copy() Function Last Updated : 22 Aug, 2019 Comments Improve Suggest changes Like Article Like Report The Ds\Set::copy() function is an inbuilt function in PHP which is used to returns the copy of the set element. Syntax: Ds\Set public Ds\Set::copy( void ) Parameter: This function does not contains any parameter. Return value: It returns the copy of set elements. Below programs illustrate the Ds\Set::copy() function in PHP: Program 1: php <?php // Create new Set $set = new \Ds\Set([10, 15, 21, 13, 16, 18]); // Display the Set element print_r($set); // Use copy() function $set->copy(); // Display the Set element print_r($set); ?> Output: Ds\Set Object ( [0] => 10 [1] => 15 [2] => 21 [3] => 13 [4] => 16 [5] => 18 ) Ds\Set Object ( [0] => 10 [1] => 15 [2] => 21 [3] => 13 [4] => 16 [5] => 18 ) Program 2: php <?php // Create new Set $set = new \Ds\Set(["Geeks", "GFG", "ABC"]); // Display the Set element print_r($set); // Use copy() function $set->copy(); // Display the Set element print_r($set); ?> Output: Ds\Set Object ( [0] => Geeks [1] => GFG [2] => ABC ) Ds\Set Object ( [0] => Geeks [1] => GFG [2] => ABC ) Reference: http://php.net/manual/en/ds-set.copy.php Comment More infoAdvertise with us Next Article PHP | DsPair copy() Function J jit_t Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_set Similar Reads PHP | DsSet copy() Function The Ds\Set::copy() function is an inbuilt function in PHP which is used to returns the copy of the set element. Syntax: Ds\Set public Ds\Set::copy( void ) Parameter: This function does not contains any parameter. Return value: It returns the copy of set elements. Below programs illustrate the Ds\Set 1 min read PHP | DsPair copy() Function The Ds\Pair::copy() function is an inbuilt function in PHP which is used to return a copy of Pair elements. Syntax: Ds\Pair::copy( void ) Parameters: This function does not accept any parameters. Return Value: This function returns a shallow copy of the pair element. Below programs illustrate the Ds 1 min read PHP | DsStack copy() Function The Ds\Stack::copy() function of PHP Ds\Stack class is used to create a shallow copy of the original stack and returns the copied stack. Syntax: Ds\Stack public Ds\Stack::copy ( void ) Parameters: This function does not accept any parameters.Return Value: This function returns a shallow copy of the 1 min read PHP | DsDeque copy() Function The Ds\Deque::copy() function is an inbuilt function in PHP which is used to return a copy of the Deque. This will return a shallow copy of the Deque. Syntax: public Ds\Deque::copy ( void ) : Ds\Deque Parameters: This function does not contain any parameter. Return Value: This function returns a cop 2 min read PHP DsQueue copy() Function The Ds\Queue::copy() Function in PHP is used to create a shallow copy of a particular Queue instance. This function does not affect the existing Queue instance, it just creates a shallow copy of the Queue and returns it. Syntax: Ds\Queue public Ds\Queue::copy ( void ) Parameters: This function does 1 min read PHP | DsVector copy() Function The Ds\Vector::copy() function is an inbuilt function in PHP which is used to create a copy of given vector. Syntax: Ds\Vector public Ds\Vector::copy( void ) Parameters: This function does not accept any parameter. Return Value: This function returns a shallow copy of the vector. Below programs illu 2 min read Like