PHP Ds\Queue pop() Function Last Updated : 09 Nov, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The Ds\Queue::pop() Function in PHP is used to remove and return the value present at the top of the Queue. In other words, it returns the value present at the front of the Queue and also removes it from the Queue. Syntax: mixed public Ds\Queue::pop ( void ) Parameters: This function does not accepts any parameters. Return Value: This function returns the value with present at the top of the Queue. The return type of the function is mixed and depends on the type of value stored in the Queue. Exception: This function throws an Underflow Exception if the Queue is empty. Below programs illustrate the Ds\Queue::pop() 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"); echo "Initial Queue is: \n"; print_r($q); // Pop an element echo "\nPopped element is: "; print_r($q->pop()); echo "\n\nFinal Queue is: \n"; print_r($q); ?> Output: Initial Queue is: Ds\Queue Object ( [0] => One [1] => Two [2] => Three ) Popped element is: One Final Queue is: Ds\Queue Object ( [0] => Two [1] => 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"); echo "Initial Queue is: \n"; print_r($q); // Pop an element echo "\nPopped element is: "; print_r($q->pop()); echo "\n\nFinal Queue is: \n"; print_r($q); ?> Output: Initial Queue is: Ds\Queue Object ( [0] => Geeks [1] => for [2] => Geeks ) Popped element is: Geeks Final Queue is: Ds\Queue Object ( [0] => for [1] => Geeks ) Reference: http://php.net/manual/en/ds-queue.pop.php Comment More infoAdvertise with us Next Article PHP SplQueue::dequeue() Function G gopaldave Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-ds_queue Similar Reads PHP DsQueue pop() Function The Ds\Queue::pop() Function in PHP is used to remove and return the value present at the top of the Queue. In other words, it returns the value present at the front of the Queue and also removes it from the Queue. Syntax: mixed public Ds\Queue::pop ( void ) Parameters: This function does not accept 2 min read PHP SplQueue::dequeue() Function The SplQueue::dequeue() function is an inbuilt function in PHP which is used to dequeues the node from the queue. Syntax: mixed SplQueue::dequeue() Parameters: This function does not accept any parameter. Return Value: This function return the value of the dequeued node. Below programs illustrate th 1 min read PHP | DsStack pop() Function The Ds\Stack::pop() function of PHP is used to remove the element present at the top of the Stack instance. This function also returns the top element of the stack after removing it. Syntax: mixed public Ds\Stack::pop ( void ) Parameters: This function does not accept any parameters.Return Value mix 2 min read PHP | DsDeque pop() Function The Ds\Deque::pop() function is an inbuilt function in PHP which is used to remove the last element from Deque (if Deque is not empty) and return it. If Deque is empty then it throws an exception. Syntax: public Ds\Deque::pop( void ) : mixed Parameters: This function does not accept any parameter. R 2 min read D3.js queue() Function The d3.queue() function is used to create a queue of a specified size. If the size is not given by default it is taken as infinite. Syntax: d3.queue(size); Parameters: This function accepts a single parameter mentioned above and described below: size: It is the optional parameter if it is not given 2 min read PHP | DsVector pop() Function The Ds\Vector::pop() function is an inbuilt function in PHP which is used to remove the last element of a vector and return it. Syntax: mixed public Ds\Vector::pop( void ) Parameters: This function does not accept any parameter. Return Value: This function returns the last element which removed from 2 min read PHP Ds\Queue pop() Function min read Like