Does the order of arguments in a conditional statement affect execution time in php?

Posted by dd0x on Stack Overflow See other posts from Stack Overflow or by dd0x
Published on 2010-04-05T01:01:39Z Indexed on 2010/04/05 1:13 UTC
Read the original article Hit count: 289

Filed under:
|

Hi,

As far as I know when writing a conditional statement in C such as the following:

if ( some_function() == 100 && my_var == 5 ) { //do something }

is slower to execute than

if ( my_var == 5 && some_function() == 100 ) { //do something }

because it's faster to execute the my_var == 5 rather than all of the code in the function ( because if my_var != 5, then the rest of the if statement would not even be executed )...so I am wondering if the same is true for conditional statements in PHP?

© Stack Overflow or respective owner

Related posts about php

Related posts about conditional