<?
$a = 1;
$b = 0;
$c = $a and $b;
$d = $a && $b;
echo "'$c' != '$d' \n";
Outcome:
'1' != ''
Documented behavior. See http://www.php.net/manual/en/language.operators.precedence.php
Moments of joy with PHP - (and other languages (but mostly PHP :D))
<?
$a = 1;
$b = 0;
$c = $a and $b;
$d = $a && $b;
echo "'$c' != '$d' \n";
'1' != ''
No comments:
Post a Comment