From:             [EMAIL PROTECTED]
Operating system: any
PHP version:      4.0.4pl1
PHP Bug Type:     Scripting Engine problem
Bug description:  string compare with "==" does not work correctly

First the test script:

<?
$a = '012345678901234567';
$b = '012345678901234568';
echo ($a == $b) ? "a equal b\n" : "a not equal b\n";
echo ($a === $b) ? "a equal b\n" : "a not equal b\n";
printf ("as string: a=%s b=%s\n", $a, $b);
printf ("as float: a=%.0f b=%.0f\n", $a, $b);
printf ("as int: a=%d b=%d\n", $a, $b);
?>

and its output:

a equal b
a not equal b
as string: a=012345678901234567 b=012345678901234568
as float: a=12345678901234567 b=12345678901234567
as int: a=2147483647 b=2147483647

Zend trys to convert the arguments to numbers if both 
arguments are strings. This is not good and its not a 
feature. 






-- 
Edit Bug report at: http://bugs.php.net/?id=9186&edit=1



-- 
PHP Development 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