[PHP] possible bug (string equality to zero)?

2005-08-11 Thread Christopher J. Bottaro
Is it a bug that ($var == 0) is always true for any string $var? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Jay Blanchard
[snip] Is it a bug that ($var == 0) is always true for any string $var? [/snip] You are comparing a string to an integer. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Torgny Bjers
No, Christopher, that is not a bug. As long as the var is empty, and if you try to compare with 0, or false, it will report true in the comparison because the variable does not contain anything, which will mean false for a boolean and 0 for a variable. If you are attempting to discover if a string

Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Scott Noyes
[snip] Is it a bug that ($var == 0) is always true for any string $var? [/snip] You are comparing a string to an integer. Right. This is clearly documented at http://www.php.net/operators.comparison -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit:

Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread Chris Shiflett
Christopher J. Bottaro wrote: Is it a bug that ($var == 0) is always true for any string $var? For any string? How about the string 5? :-) PHP tries to help you out, but there's not much it can do when you ask it to compare a string like 'foo' to an integer. It scans your string from left

Re: [PHP] possible bug (string equality to zero)?

2005-08-11 Thread xfedex
Hi, Is it a bug that ($var == 0) is always true for any string $var? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Check this out! http://us3.php.net/manual/en/types.comparisons.php -- PHP General Mailing List