The only reason I could see that not working is if PHP is typecasting
"test" to (int) in the second example...

$qty = "0";  (string)
"test" = "test";  (string)
"0" != "test"  (evaluates true)

$qty = 0; (int)
"test" = 0;  (when cast to int)
0 != 0  (evaluates false)

e.g. By comparing an int to a string in the 2nd example, the string is
casted to int, and the int cast of "test" is 0.


-----Original Message-----
From: Robin Chen [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, October 25, 2001 4:06 AM
To: [EMAIL PROTECTED]
Subject: [PHP] = 0 and = "0"


why does

<? $qty = "0" ; if ($qty != "test") print "qty is not test"; ?>

work properly but not the following

<? $qty = 0 ; if ($qty != "test") print "qty is not test"; ?>

Thanks,

Robin

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to