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
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
Try
echo ('test'=='0');
and you'll see what Rasmus meant.
Sincerely,
Maxim Maletsky
PHP Beginner
www.phpbeginner.com
-Original Message-
From: Bas Jobsen [mailto:[EMAIL PROTECTED]]
Sent: Sunday, August 11, 2002 4:56 PM
To: PHP General
Subject: [PHP] why true?
echo
3 matches
Mail list logo