$x = "a string";
if ($x == 142)
{
echo "lol, of course $x is a number";
}
else
{
echo "$x is clearly not equal to 142";
}
When run:
lol, of course a string is a number
You must use ===
$x = "a string";
if ($x === 142)
{
echo "lol, of course $x is a number";
}
else
{
echo "$x is clearly not equal to 142";
}
When run:
a string is clearly not equal to 142