The Queue::push()
function in PHP is used to insert an element or list of elements at the back of the priority queue.
Figure 1 shows the visual representation of the Queue::push()
function.
queue_name->push(element(s))
// where the queue_name is the name of the queue
This function requires an element or list of elements separated by commas as a parameter.
This function inserts the element or list of elements sent as a parameter at the back of the priority queue.
<?php$queue = new \Ds\Queue();#sending the list of elements$queue->push(1,3,5,2);echo("Queue before 0");print_r($queue);#sending single element$queue->push(0);######output#######Queue before 0 : 1->3->5->2echo("Queue after 0");print_r($queue);######output#######Queue after 0 : 1->3->5->2->0?>