Op 3/10/10 1:29 PM, Auke van Slooten schreef: > 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. > > 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... I think you can probably rely on the call order but given no formal spec for php it's not ironclad - multiCall() will never be called before methodOne() or methodTwo() because the return values of those are needed to pass to multiCall() BUT you can't say for sure whether $client->system will be evaluated before the methodOne() and methodTwo() calls ... looking at it the code doesn't actually require it, in practice it doubt the engine will change so dramatically that the call order would change. but who cares. the code is full of magic, which makes it difficult to understand and maintain ... fix it so that it's explicit about what it's doing so that other developers who read it will grasp the concept without having to dig into your magic methods. this solves the problem of undiscernable magic and possible issues with resolution order in the future as well (which if they happened would be a royal PITA to debug, given the magic methods involved) > > regards, > Auke van Slooten > Muze > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php