note 46547 deleted from language.types.array by betz
| From: | betz@php.net | Date: | Tue, 18 Oct 2005 06:38:28 +0000 |
| Subject: | note 46547 deleted from language.types.array by betz | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-97143@lists.php.net to get a copy of this message | ||
Note Submitter: mwlist atto lanfear dotto com (Marc W)
----
It might be worth noting that Maxim Maletsky's comment from 2002 is no longer valid for newer
PHP versions (at least 4.3.4 and 5.0.1):
the following code:
$test[-10] = "-10";
$test[-11] = "-11";
$test[] = "i'm expecting a key value of-9";
var_dump($test);
in fact, prints:
array(3) { [-10]=> string(3) "-10" [-11]=> string(3) "-11" [0]=>
string(22) "i'm expecting a key value of -9" }
I.e. while negative integers are valid as indices, they don't affect the internal counter for
addition of new items, which appears to only be affected by positive integer key values.
Won-kay.
Marc.