|
Posted by Michael Fesser on 01/07/08 16:35
..oO(jodleren)
>How do IF behave in php?
>
>Say,
>if( $goahead && copy($somefile1, $somefile2) )
> echo "hello world";
>
>What if $goahead is false, will the if the fall, or test all of the
>statements?
PHP uses lazy evaluation. As soon as the result is known, the evaluation
stops. Because of this behaviour you can write things like
$rs = mysql_query(...) or die(...);
Micha
Navigation:
[Reply to this message]
|