Login   Register  
PHP Classes
elePHPant
Icontem

File: demo/stackdemo.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Ordland  >  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: 2013-04-08 04:51
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>";

?>