I expect the following code to print "false"
<?php
$a = 4;
$b = 45;
echo $a==$b;
?>
but prints nothing.
I expect the following code to print "false"
<?php
$a = 4;
$b = 45;
echo $a==$b;
?>
but prints nothing.
It doesn't print anything because the result of $a==$b
is a boolean, and false
is converted to an empty string. Use var_dump
instead (if you are debugging your code):
var_dump($a==$b);
Or alternatively you can use echo
this way:
echo ($a==$b) ? 'true' : 'false';