ID: 41905 User updated by: domluc at gmail dot com Reported By: domluc at gmail dot com Status: Bogus Bug Type: Strings related Operating System: GNU/Linux Debian PHP Version: 4.4.7 New Comment:
Ok, I know way to do this,but, I think this is incorrect. The auto cast trunk the variable without warning. Previous Comments: ------------------------------------------------------------------------ [2007-07-05 14:28:11] [EMAIL PROTECTED] '==' will see the strings as numeric values, use === if you expect a type safe comparison (as you noticed and documented). ------------------------------------------------------------------------ [2007-07-05 14:20:27] domluc at gmail dot com Description: ------------ Obs:This bug hape in PHP 4.4.x and 5.2.x I have a string with 17bytes, sample: <code> $var1 = '99990000000650719'; $var2 = '99990000000650718'; </code> if I compare these strings with: <code> if ( $var1 == $var2) echo "Equal" else echo 'Not Equal' </code> it will print Equal, but this is incorrect. The solution to correct do this, is using '===': $var1 === $var2 But this behavior is wrong. I beliave that when php engine compare with '==' it cast variables to integer, and 17th byte is ignored! ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41905&edit=1