<?phpclass Yigin {var $dizi = array();function push($eleman) {array_push($this->dizi, $eleman);}function pop() {$eleman = $this->top();array_pop($this->dizi);return $eleman;}function top() {$say = count($this->dizi);if ($say == 0) {return null;}return $this->dizi[count($this->dizi)-1];}function uzunluk() {return count($this->dizi);}}$s=new Yigin;$s->push(["test1","test2"]);$s->push(["test3"]);$s->push(["test4"]);print_r($s->dizi);print_r($s->pop());print_r($s->dizi);print_r($s->top());print_r($s->uzunluk());?>
Çıktısı
Array([0] => Array([0] => test1[1] => test2)[1] => Array([0] => test3)[2] => Array([0] => test4))Array([0] => test4)Array([0] => Array([0] => test1[1] => test2)[1] => Array([0] => test3))Array([0] => test3)2