Re: [PHP] using returned references directly?
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(); Don't know if this would work, but you could give it it a try : call_user_func(array(get_class($A-getObjectB()), 'methodFromObjectB')); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] using returned references directly?
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: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using returned references directly?
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(); But since I only want to use object B once, it seems like a waste to store it and then use it. I do this kind of thing in other OO languages quite frequently. Jeff Schmidt signature.asc Description: OpenPGP digital signature