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 spaces as parameter. All of these values are pushed or inserted in the Queue one after other.
Return Value: This function does not returns any value.
Below program illustrate the Ds\Queue::push() Function in PHP:
Program 1:
<?php // Declare new Queue $q = new \Ds\Queue(); // Add elements to the Queue $q->push("One"); $q->push("Two"); $q->push("Three"); echo "Queue is: \n"; print_r($q); ?> |
Queue is:
Ds\Queue Object
(
[0] => One
[1] => Two
[2] => Three
)
Program 2:
<?php // Declare new Queue $q = new \Ds\Queue(); // Add elements to the Queue $q->push("One"); $q->push("Two", "2"); $q->push("Three", "3", "4"); echo "Queue is: \n"; print_r($q); ?> |
Queue is:
Ds\Queue Object
(
[0] => One
[1] => Two
[2] => 2
[3] => Three
[4] => 3
[5] => 4
)
Reference: http://php.net/manual/en/ds-priorityqueue.push.php
Recommended Posts:
- PHP | Ds\Vector push() Function
- PHP | Ds\Deque push() Function
- PHP | Ds\Sequence push() Function
- PHP Ds\PriorityQueue push() Function
- PHP | SplDoublyLinkedList push() Function
- PHP | Ds\Stack push() Function
- How to push a value based on matched value in PHP ?
- How to get the function name inside a function in PHP ?
- PHP | dir() Function
- PHP | Ds\Map put() Function
- PHP | Ds\Map xor() Function
- PHP | Ds\Set xor() Function
- PHP | Ds\Set contains() Function
- PHP | ord() Function
- PHP Ds\Map sum() Function
- PHP | Ds\Map first() Function
- PHP | Ds\Map get() Function
- PHP | Ds\Set first() Function
- PHP | next() Function
- PHP | Ds\Set last() 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.

