returning arrays

From: Date: Fri, 01 Oct 1999 11:10:40 +0000
Subject: returning arrays
Groups: php.dev 
Request: Send a blank email to php-dev+get-11408@lists.php.net to get a copy of this message
OK guys, I give up... class Vector { var $items=array(); function addElement($e) { $this->items[count($this->items)] = $e; } // Return the items function getItems() { return $this->items; } function draw() { while(list($key,$item)=each($this->items)) { printf("Indice: %s - Item: %s <br>", $key, $item); } reset($this->items); } } $myArray = new Vector; $myArray->addElement("ola1"); $myArray->addElement("ola2"); $myArray->addElement("ola3"); $myArray->draw(); $ass = $myArray->getItems(); while(list($key,$item)=each($arr)) { printf("Key: %s -- Item: %s<br>", $key, $item); } what is going wrong in getItems()? Can any one please explain me this one? Thanks in advance... Rui Lopes

« previous php.dev (#11408) next »