ID:               22201
 Updated by:       [EMAIL PROTECTED]
 Reported By:      [EMAIL PROTECTED]
-Status:           Open
+Status:           Bogus
 Bug Type:         Arrays related
 Operating System: SuSE 7.2
 PHP Version:      4.3.0
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. Because of this, we hope you add your comments
to the existing bug instead.

Thank you for your interest in PHP.

dupe of bug #21918


Previous Comments:
------------------------------------------------------------------------

[2003-02-13 05:26:09] [EMAIL PROTECTED]

A string which would evaluate to a negative integer (such as "-123")
will not be turned into an integer when used as an array key. I don't
recall seeing anywhere an explicit explanation of how strings are
treated when used as array keys, but obviously those strings that
are valid representations of non-negative integers are implicitly
treated as integers, and everything else is seen as strings.
I think it would make sense to extend this to _all_ valid integers, as
the behavior in this example is not quite what one would expect:

$arr = array(-1 => "a", 0 => "b", 1 => "c");
$arr["-1"] = "e";
$arr["0"] = "f";
$arr["1"] = "g";
print_r($arr);
echo "\n";
var_dump($arr);


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=22201&edit=1

Reply via email to