class Ob { var $prop; } class Test { function setMe(&$ob) { $ob->prop = $this; } } $ob = new Ob(); $test = new Test(); $test->setMe($ob); if ($ob->prop) error_log("PHP is OK"); else error_log("PHP is a fucking MARE");
What is my problem here? Please help!
How about you explain what you're trying to do instead of asking why some random code snippet doesn't work (according to you)?
The code does "work" for me, btw... for whatever it's supposed to be doing. $ob->prop is now a "Test" object...which is what the code does...
For example, if you added
var $foo = 'bar';
to the Test object and then printed out $ob->prop->foo, you'd get 'bar'.
--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/
php|architect: The Magazine for PHP Professionals – www.phparch.com
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php