diff --git a/language/types.xml b/language/types.xml index 816eccdc11..f01ee85296 100644 --- a/language/types.xml +++ b/language/types.xml @@ -1,5 +1,5 @@ - + Types @@ -1317,12 +1317,8 @@ echo $arr["somearray"]["a"]; // 42 If you do not specify a key for a given value, then the maximum of the integer indices is taken, and the new key will be that - maximum value + 1--unless that maximum value is negative (is it - perfectly legal to have negative array indices). In this case, - the new key will be 0. If no integer indices - exist yet, the key will be 0 (zero). If you - specify a key that already has a value assigned to it, that - value will be overwritten. + maximum value + 1. If you specify a key that already has a value + assigned to it, that value will be overwritten. 43, 6 => 32, 7 => 56, "b" => 12); + + + As of PHP 4.3.0, the index generation behaviour described + above has changed. Now, if you append to an array in which + the current maximum key is negative, then the next key + created will be zero (0). Before, the new + index would have been set to the largest existing key + 1, + the same as positive indices are. + + Using &true; as a key will evaluate to integer 1 as key. Using &false; as a key will evaluate @@ -1397,13 +1403,22 @@ unset($arr); // This deletes the whole array As mentioned above, if you provide the brackets with no key specified, then the maximum of the existing integer indices is - taken, and the new key will be that maximum value + 1--unless - that maximum value is negative (is it perfectly legal to have - negative array indices). In this case, the new key will be - 0. If no integer indices exist yet, the key - will be 0 (zero). If you specify a key that - already has a value assigned to it, that value will be - overwritten. + taken, and the new key will be that maximum value + 1 . If no + integer indices exist yet, the key will be 0 + (zero). If you specify a key that already has a value assigned + to it, that value will be overwritten. + + + + + As of PHP 4.3.0, the index generation behaviour described + above has changed. Now, if you append to an array in which + the current maximum key is negative, then the next key + created will be zero (0). Before, the new + index would have been set to the largest existing key + 1, + the same as positive indices are. + + Note that the maximum integer key used for this need