note 30351 rejected from language.oop by rioter

From: Date: Sat, 15 Mar 2003 06:36:51 +0000
Subject: note 30351 rejected from language.oop by rioter
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-45338@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.

« previous php.notes (#45338) next »