num=0; } function pop(){ if( $this->num != 0 ) { $this->num = $this->num - 1; $tmp = $this->arg[$this->num]; return $tmp; } } function push( $x ) { $this->arg[$this->num] = $x; $this->num++; } //デストラクタ function destroy(){ unset($this); } } // +-------------------------------------------------------+ // | | // | キュークラスのサンプルデータ | // | | // +-------------------------------------------------------+ /* $c=new Queue(); $c->push(4); $c->push(3); $c->push(5); $c->push(7); print $c->pop()."\n"; print $c->pop()."\n"; print $c->pop()."\n"; print $c->pop()."\n"; $c->push(3); print $c->pop()."\n"; print $c->pop()."\n"; */ ?>