Re: PHP 4.0 Bug #9186 Updated: string compare with "==" does not work correctly
| From: | Zeev Suraski | Date: | Fri, 09 Feb 2001 17:35:42 +0000 |
| Subject: | Re: PHP 4.0 Bug #9186 Updated: string compare with "==" does not work correctly | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-46094@lists.php.net to get a copy of this message | ||
At 17:59 9/2/2001, tom.anheyer@berlinonline.de wrote:
ID: 9186 User Update by: tom.anheyer@berlinonline.de Status: Bogus Bug Type: Scripting Engine problem Description: string compare with "==" does not work correctly I think there is no reason to convert any type if both operands of the comparision are of the same type. It costs time and it's completely not necessary. This is a bug.No, it's not a bug. It's definitely an intended behavior. PHP does it's best to do the 'right thing' in the most common cases. Because of the way it works, effectively, comparing strings that 'look like numbers' as if they were numbers makes life much, much easier. If you want to enforce a string comparison, use strcmp(). Zeev