<?php
class Stack{
private $_data = array();
private $_end = null;
public function push($data){
if($this->_end === null){
$this->_end = 0;
}else{
$this->_end++;
}
$this->_data[$this->_end] = $data;
}
public function pop(){
if(empty($this->_data)){return false;}
$ret = $this->_data[$this->_end];
//array_pop($this->_data);
array_splice($this->_data, $this->_end);
$this->_end--;
return $ret;
}
public function get_data(){
return $this->_data;
}
}
$stack = new Stack();
$stack->push('a');
$stack->push('b');
$stack->push('c');
$stack->pop();
print_r($stack->get_data());