Re: PHP4: calling method on returned object

From: Date: Thu, 30 Mar 2006 11:15:32 +0000
Subject: Re: PHP4: calling method on returned object
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-232911@lists.php.net to get a copy of this message
On Thursday 30 March 2006 14:05, Karl Glennon wrote: > Hi there, > > I have an object structure, whereby a location object contains a method > to return it's map object. The map object contains a method to return > it's URL. > > I expected to have the ability to get the url of a location's map with > the floowing statement: > > print $this->Location->GetMap()->GetUrl(); > > This works in PHP5, but in PHP4 it causes a parse error (the application > has to run on PHP4 for the moment). > > I'm currently working around this limitation as so: > > $locationMap = $this->Location->GetMap(); > print $locationMap->GetUrl(); > > Unfortunatly this senario is occuring in dozens of palces in the > application, and is quite unsightly compared to the PHP5 syntax. > > Is there any other syntax in PHP4 to allow me to concisely call a method > on a return object? eg. ($this->Location->GetMap())->GetUrl() .. which > doens't work. Try curly brackets. > > Thanks for any help, > > Karl Glennon -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: [application/pgp-signature]
« previous php.general (#232911) next »