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>
Related examples in the same category