PHP Classes

File: demo/stackdemo.php

Recommend this page to a friend!
  Classes of Ordland Euroboros   PHP Collections Framework   demo/stackdemo.php   Download  
File: demo/stackdemo.php
Role: Example script
Content type: text/plain
Description: A demo using Stack
Class: PHP Collections Framework
Manipulate collections of objects like Java and C#
Author: By
Last change:
Date: 10 years ago
Size: 622 bytes
 

Contents

Class file image Download
<?php

require "autoloader.php";
use
Resource\Native\String as String;
use
Resource\Collection\Stack as Stack;

$mithos = new String("Mithos Yggdrasill");
$martel = new String("Martel Yggdrasill");
$yuan = new String("Yuan Ka-fei");
$kratos = new String("Kratos Aurion");

$stack = new Stack;
$stack->push($mithos);
$stack->push($martel);
$stack->push($yuan);
$stack->push($kratos);

echo
$stack->peek();
echo
"<br>";
echo
$stack->pop();
echo
"<br>";
echo
$stack->peek();
echo
"<br>";
echo
$stack->pop();
echo
"<br>";
echo
$stack->peek();
echo
"<br>";
echo
$stack->pop();
echo
"<br>";

?>