Re: PHP4: calling method on returned object

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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: pgpDuZzyCeX6j.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux