Edit report at http://bugs.php.net/bug.php?id=9307&edit=1
ID: 9307
Comment by: info at fedushin dot ru
Reported by: david@php.net
Summary: Numeric-looking array keys are forced to be integers
Status: Closed
Type: Bug
Package: Scripting Engine problem
Operating System: Linux
PHP Version: 4.0.4pl1
New Comment:
Some arguments to consider (integer)1 and "1" as different array keys
are given in Bug #51384.
Previous Comments:
------------------------------------------------------------------------
[2001-03-06 08:24:20] stas@php.net
Right, this is how PHP works. That's not a bug, that's an
intended behaviour.
------------------------------------------------------------------------
[2001-02-16 16:17:20] david@php.net
<?
$myarray['105'] = 'Hello';
$myarray[(string)'106'] = 'Goodbye';
var_dump($myarray);
?>
array(2) {
[105]=>
string(5) "Hello"
[106]=>
string(7) "Goodbye"
}
It shouldn't be auto-converting array keys to numbers if they're already
of a different type! Let's say I have an whole list of items as my array
keys, and one just happens to be "able" to be converted into a number.
Suddenly one of my array keys is no longer a string.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=9307&edit=1