Is anybody able to exlain this behaviour:
<?php
$var1 = true;
$var2 = 0;
$var3 = $var1 AND $var2;
var_export($var3); // Output: true
var_export(true AND 0); // Output: false
var_export($var1 AND $var2); // Output: false
Output comes from PHP 7.0
Why is the first output true
while the 3rd output is false
?
By the way: it doesnt matter if $var2
is 0
or false
. The behaviour is the same.
@all: I know that I SHOULD use &&
and I always do!