Hi,
I am new to php, just started.. i was trying this:
$var1=3;
$var2 = 3.0;
if(var1==var2)
print "true";
else
print "false";
if (var1===var2)
print "true1";
else
print "false";
the tutorial says == just checks the equality, so doesnt that mean the first test should return a true ?? but the answer is false in both tests. Please explain.
Thanks
A small question..
Moderator: General Moderators
You forgot to precede the variables in the if statement with '$'. Change it and it will be true.
Code: Select all
if($var1==$var2) <-- HERE
print "true";
else
print "false";