PHP SplQueue::dequeue() Function Last Updated : 23 Jun, 2023 Summarize Comments Improve Suggest changes Share Like Article Like Report 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 the SplQueue::dequeue() function in PHP: Program 1: php <?php // Create a new empty queue $gfg = new SplQueue(); $gfg[] = 1; $gfg[] = 2; $gfg[] = 3; // Dequeue element echo $gfg->dequeue() . "\n"; echo $gfg->dequeue() . "\n"; ?> Output: 1 2 Program 2: php <?php // Create some fixed size array $gfg = new SplQueue(); $gfg[] = 1; $gfg[] = 5; $gfg[] = 1; $gfg[] = 11; $gfg[] = 15; $gfg[] = 17; foreach ($gfg as $elem) { echo $elem . "\n"; } $gfg->dequeue(); $gfg->dequeue(); $gfg->dequeue(); // Print result after dequeue foreach ($gfg as $elem) { echo "dequeue: " . $gfg->dequeue() . "\n"; } ?> Output: 1 5 1 11 15 17 dequeue: 11 dequeue: 15 dequeue: 17 Reference: https://www.php.net/manual/en/splqueue.dequeue.php Comment More infoAdvertise with us Next Article PHP DsQueue push() Function R R_Raj Follow Improve Article Tags : Web Technologies PHP PHP-function Similar Reads PHP SplQueue::enqueue() Function The SplQueue::enqueue() function is an inbuilt function in PHP which is used to add the element to the queue. Syntax: void SplQueue::enqueue( $val ) Parameters: This function accepts a single parameter $val which specifies the value for add (enqueue) element. Return Value: This function does not ret 1 min read PHP DsQueue push() Function The Ds\Queue::push() Function in PHP is used to push or insert values in a PriorityQueue instance. This function can also insert a list of values directly to the Queue. Syntax: void public Ds\Queue::push($value1, $value2, .... $valueN) Parameters: This function accepts a list of values separated by 1 min read 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 | DsSequence reduce() Function The Ds\Sequence::reduce() function is an inbuilt function in PHP which is used to reduce the sequence to a single value using a callback function. Syntax: mixed abstract public Ds\Sequence::reduce ( callable $callback [, mixed $initial ] ) Parameters: This function accepts two parameters as mentione 2 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 | DsSequence remove() Function The Ds\Sequence::remove() function is an inbuilt function in PHP which is used to remove and return a value by index. Syntax: mixed abstract public Ds\Sequence::remove ( int $index ) Parameters: This function accepts a single parameter $index which holds the index of value to remove. Return value: T 1 min read Like