Re: Execution order of PHP
| From: | Bruno Fajardo | Date: | Wed, 10 Mar 2010 13:37:40 +0000 |
| Subject: | Re: Execution order of PHP | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-302654@lists.php.net to get a copy of this message | ||
2010/3/10 Auke van Slooten <auke@muze.nl>
>
> Hi,
>
> In a hobby project I'm relying on the order in which the following piece of PHP code is
> executed:
>
> $client->system->multiCall(
> $client->methodOne(),
> $client->methodTwo()
> );
>
> Currently PHP always resolves $client->system (and executes the __get on $client) before
> resolving the arguments to the multiCall() method call.
Hi!
Can't you call the methods $client->methodOne() and
$client->methodTwo() before the call to $client->system->multiCall()?
That way, you could store they values in local variables, and then
pass them to the $client->system->multiCall(), assuring that those
methods are executed before the multiCall(). Something like:
$methodOne = $client->methodOne();
$methodTwo = $client->methodTwo();
$client->system->multiCall($methodOne, $methodTwo);
Cheers,
Bruno.
>
> Is this order something that is specified by PHP and so can be relied upon to stay the same in
> the future or is it just how it currently works.
>
> If it cannot be relied upon to stay this way, I will have to rewrite the multiCall method and
> API...
>
> regards,
> Auke van Slooten
> Muze
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>