Stack In Use

 
    <html>
<head>
<title>Stack</title>
</head>
<body>
<?php
     $stack = array();
 
     $book_one = "One";
     $book_two = "Two";
     $book_three = "Three";
 
     array_push($stack, $book_one);
     array_push($stack, $book_three);
     array_push($stack, $book_two);
 
     $n = count ($stack);
     while ($book = array_pop ($stack)) {
          print ("Item $n: $book<br />\n");
          $n--;
     }
?>
</body>
</html>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.