Re: Execution order of PHP

From: Date: Wed, 10 Mar 2010 14:13:00 +0000
Subject: Re: Execution order of PHP
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-302657@lists.php.net to get a copy of this message
Bruno Fajardo wrote:
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() );
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);
Hi, This is not what I meant. I should perhaps mention that it's an xml-rpc client and the method calls are remote method calls. The multiCall method gathers multiple method calls into a single request. The trick I'm using now is to set a private property in the $client->__get() method when the property you're accessing is 'system'. From then untill you call the method 'multiCall', instead of calling the methods (in this case methodOne and methodTwo) the client creates a new object with the call information (method name and arguments) and returns that. In multiCall all arguments are therefor call information objects and multicall creates a single request based on that information. So in your example the client would simply call methodOne and methodTwo and return the results. Then it would try to do a multiCall with whatever the previous methods have returned. regards, Auke van Slooten Muze

« previous php.general (#302657) next »