Re: possible bug (string equality to zero)?
| From: | Chris Shiflett | Date: | Thu, 11 Aug 2005 16:06:09 +0000 |
| Subject: | Re: possible bug (string equality to zero)? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-220451@lists.php.net to get a copy of this message | ||
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 to right and uses the leading numbers to create the integer. For example, 53chris is 53, but chris53 is 0 (no leading numbers). Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/