Stack in Use : Stack : Data Structure PHP Source Code


PHP Source Code » Data Structure » Stack »

 

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>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Data Structure
» Stack