In this example which parallels a problem I am having in my real life script. I would like to have a global object, in this case $tester. I would then like to be able to store local references to this global object right inside the class. These are assigned byref in the classes constructor.
This script should, by my understanding work, only it craps out in test2's constructor: "$o = &$tester;". Any help would be greatly appreciated. (Please cc me on your replies) John Hughes <?php class test { var $a; function test() { $this->a = 10; } function doit() { $this->a = 20; } } global $tester; $tester = new test(); class test2 { var $o; function test2() { $o = &$tester; } function mod() { $o->doit(); } } echo $tester->a . "\n"; // Should be 10 $newtest = new test2(); $newtest->mod(); echo $tester->a . "\n"; // Should be 20 ?> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php