From:             [EMAIL PROTECTED]
Operating system: Linux GNU/Debian
PHP version:      4.2.3
PHP Bug Type:     Arrays related
Bug description:  array key comparision issue(?)

test.php:
<?php
  $val1 = "any";
  $test = array("any"=>"any", "3"=>"+3", "2"=>"+2",
                "1"=>"+1", "0"=>"0", "-1"=>"-1",
                "-2"=>"-2", "-3"=>"-3" );
  foreach( $test AS $key=>$val )
     printf("'%s' vs. '%s' result: %d\n", $val1, $key, ($key == $val1) );
?>

$ php test.php
'any' vs. 'any' result: 1
'any' vs. '3' result: 0
'any' vs. '2' result: 0
'any' vs. '1' result: 0
'any' vs. '0' result: 1
'any' vs. '-1' result: 0
'any' vs. '-2' result: 0
'any' vs. '-3' result: 0

$ php -v
4.2.3

Shouldn't "'any' vs. '0'" give 0 as result?
-- 
Edit bug report at http://bugs.php.net/?id=21782&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=21782&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=21782&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=21782&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=21782&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=21782&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=21782&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=21782&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=21782&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=21782&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=21782&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=21782&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=21782&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=21782&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=21782&r=gnused

Reply via email to