Possible Duplicate:
comparing two variables returns false result
<?php
if( "32 is this a bug of php " == 32)
echo "true";
else
echo "false";
?>
output is :
true
you can see its output at
http://codepad.org/hgOisqZ8
why this condition is evaluated as true?
This is discussed in the PHP Manual.
Note the part that states
Since your string starts with
32PHP will compareif(32 == 32)which will be true.Use type safe checks, that takes the datatype into consideration, when dealing with types that could be different if this behaviour is not desired. Like