• PHP Video Tutorials

PHP - Ds\Queue::pop() Function



Ds\Queue::pop() function can remove and return a value at the front of a queue.

Syntax

public mixed Ds\Queue::pop( void )

Ds\Queue::pop() function doesn't have any parameters.

Ds\Queue::pop() function can return the removed value that was at the front of a queue. This function can throw UnderflowException if empty.

Example

<?php  
   $queue = new \Ds\Queue();  
   $queue->push("Tutorials"); 
   $queue->push("Point"); 
   $queue->push("India"); 
  
   echo "The initial queue is: \n"; 
   print_r($queue); 
  
   echo "\n The popped element is:"; 
   print_r($queue->pop()); 
  
   echo "\n The final queue is: \n"; 
   print_r($queue); 
?>
php_function_reference.htm
Advertisements