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 the SplQueue::dequeue() function in PHP:
Program 1:
<?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"; ?> |
1 2
Program 2:
<?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"; } ?> |
1 5 1 11 15 17 dequeue: 11 dequeue: 15 dequeue: 17
Reference: https://www.php.net/manual/en/splqueue.dequeue.php
Recommended Posts:
- How to call a function that return another function in JavaScript ?
- How to get the function name from within that function using JavaScript ?
- How to get the function name inside a function in PHP ?
- D3.js | d3.map.set() Function
- PHP | max( ) Function
- PHP | exp() Function
- D3.js | d3.min() function
- PHP | Ds\Map get() Function
- CSS | rgb() Function
- PHP | min( ) Function
- p5.js | box() Function
- p5.js | value() Function
- D3.js | d3.rgb() Function
- p5.js | int() function
- D3.js | d3.hcl() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



