PHP - Fonction Ds \ Stack :: pop ()

La fonction Ds \ Stack :: pop () peut supprimer et renvoyer la valeur en haut d'une pile.

Syntaxe

public mixed Ds\Stack::pop( void )

La fonction Ds \ Stack :: pop () n'a aucun paramètre.

La fonction Ds \ Stack :: pop () peut retourner la valeur supprimée qui était en haut d'une pile.

La fonction Ds \ Stack :: pop () peut lancer UnderflowException si elle est vide.

Exemple

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