note 30351 added to language.oop

From: Date: Fri, 14 Mar 2003 20:55:30 +0000
Subject: note 30351 added to language.oop
Groups: php.notes 
Request: Send a blank email to php-notes+get-45323@lists.php.net to get a copy of this message
How about this. What do you expect the following code to display? class foo { var $myvar; function bar() { $this->myvar='abc'; function foobar() { $this->myvar = '123'; } echo $this->myvar; } } $myclass = new foo; $foo->bar(); I expected it to display 123, but it displayed abc. I have no clue how to directly address a class variable from a nested function. -- http://www.php.net/manual/en/language.oop.php http://master.php.net/manage/user-notes.php?action=edit+30351 http://master.php.net/manage/user-notes.php?action=delete+30351 http://master.php.net/manage/user-notes.php?action=reject+30351

« previous php.notes (#45323) next »