RE: [PHP] using returned references directly?

From: Date: Tue, 18 May 2004 08:44:09 +0000
Subject: RE: [PHP] using returned references directly?
Groups: php.general 
Request: Send a blank email to php-general+get-186459@lists.php.net to get a copy of this message
On 17 May 2004 22:26, Jeff Schmidt wrote: > Hello, > Say I have object A, with method getObjectB(), which returns a > reference to object2. > > Is there a way to do something like > $A->getObjectB()->methodFromObjectB(); > > ?? > > When I try that, I get a parse error? Is this simply not > possible with > PHP, or is the syntax just a little different? > > I mean, I could: > > $b = $A->getObjectB(); > $b->methodFromObjectB(); That's how you have to do it in PHP 4. In PHP 5, you will be able to use the collapsed version -- it's one of the OO improvements. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Headingley Campus, LEEDS, LS6 3QS, United Kingdom Email: m.ford@leedsmet.ac.uk Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211

« previous php.general (#186459) next »