In the PHP code
if(a() && b())
when the first argument is false
, b()
will not be evaluated.
Similarly, in
if (a() || b())
when the first argument is true
, b()
will not be evaluated..
Is this true for all languages, like Java, C#, etc?
This is the test code we used.
<?php
function a(){
echo 'a';
return false;
}
function b(){
echo 'b';
return true;
}
if(a() && b()){
echo 'c';
}
?>