Because you are comparing a string to a number. PHP has to choose to either compare the two as strings or as numbers. The numerical value of the string 'test' is 0 which means it works out to 0 == 0 which is true.
If you want to force a string comparison, you can use strcmp() or, if you want to force a comparison on both value and type, use === instead of == -Rasmus On Sun, 11 Aug 2002, Bas Jobsen wrote: > > echo ('test'==0); > gives 1 why? > > Thanks, > > Bas > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php