• PHP Video Tutorials

PHP - Ds\Stack::pop() Function



Ds\Stack::pop() function can remove and return the value at the top of a stack.

Syntax

public mixed Ds\Stack::pop( void )

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

Ds\Stack::pop() function can return the removed value that was at the top of a stack.

Ds\Stack::pop() function can throw UnderflowException if empty.

Example

<?php 
   $stack = new \Ds\Stack(); 
   $stack->push("Tutorials"); 
   $stack->push("Point"); 
   $stack->push("India"); 
  
   print_r($stack); 
   print_r($stack->pop()); 
   print_r($stack); 
?>
php_function_reference.htm
Advertisements