Bug #13884 Updated: Arrays does not work good in objects

From: Date: Wed, 31 Oct 2001 18:08:09 +0000
Subject: Bug #13884 Updated: Arrays does not work good in objects
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-69428@lists.php.net to get a copy of this message
ID: 13884 Updated by: cnewbill Reported By: starky@udm.ru Old Status: Open Status: Bogus Bug Type: Class/Object related Operating System: Win98 PHP Version: 4.0.6 New Comment: RTFM http://www.php.net/manual/en/language.oop.php HINT: You should not be using a $ WRONG : $this->$items['foo']='test'; RIGHT : $this->items['foo']='test'; WRONG : echo $test->$items['bar']; (unless you had a global items array with items['bar'] = "items['foo']") RIGHT : echo $test->items['bar']; -Chris Previous Comments: ------------------------------------------------------------------------ [2001-10-31 06:17:50] starky@udm.ru <? class test{ var $items; function test1(){ $this->$items['foo']='test'; } } $test=new test; $test->test1(); echo $test->$items['bar']; ?> last line will output "test" ------------------------------------------------------------------------ Edit this bug report at http://bugs.php.net/?id=13884&edit=1

« previous php.dev (#69428) next »