PHP Ds\Queue copy() Function Last Updated : 23 Aug, 2019 Comments Improve Suggest changes Like Article Like Report 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 not accepts any parameters. Return Value: This function creates a shallow copy of an existing Queue instance and returns it. Below programs illustrate the Ds\Queue::copy() Function in PHP: Program 1: php <?php // Declare new Queue $q = new \Ds\Queue(); // Add elements to the Queue $q->push("One"); $q->push("Two"); $q->push("Three"); // Create copy of this Queue // instance and print it print_r($q->copy()); ?> Output: Ds\Queue Object ( [0] => One [1] => Two [2] => Three ) Program 2: php <?php // Declare new Queue $q = new \Ds\Queue(); // Add elements to the Queue $q->push("Geeks"); $q->push("for"); $q->push("Geeks"); // Create copy of this Queue // instance and print it print_r($q->copy()); ?> Output: Ds\Queue Object ( [0] => Geeks [1] => for [2] => Geeks ) Reference: http://php.net/manual/en/ds-priorityqueue.copy.php Comment More infoAdvertise with us Next Article PHP | DsDeque copy() Function G gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_queue Similar Reads 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 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 | 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 | 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 SplQueue::__construct() Function The SplQueue::__construct() function is an inbuilt function in PHP which is used to construct a queue which is implemented using a doubly-linked list. Syntax: void SplQueue::__construct(void) Parameters: This function does not accept any parameter. Return Value: This function does not return any val 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