This has got me really confused, when did setting a variable = 0 make everything true in an if then statement (except for numbers) or has this always been the case and I just never ran across it. Is there a possible setting in php?
The code below should not echo Hello world but it does.
<?php
$test = 0;
if ($test == "Y") {
echo "Hello world";
}
?>
This code will echo Hello World and I do not believe it should either....
<?php
$test = 0;
if ($test == "TEST") {
echo "Hello world";
}
?>
Comment out the var $test and the code work as expected does not echo out Hello World
//$test = 0;
if ($test == "TEST") {
echo "Hello world";
}
?>
Set var = "0" and it works as expected does not echo out Hello World
<?php
$test = "0";
if ($test == "1") {
echo "Hello world";
}
?>