torben Fri Jun 27 17:27:30 2003 EDT
Modified files:
/phpdoc/en/language types.xml
Log:
Document the changed array indexing, pending information from the dev
team on what it's really supposed to be doing.
Index: phpdoc/en/language/types.xml
diff -u phpdoc/en/language/types.xml:1.122 phpdoc/en/language/types.xml:1.123
--- phpdoc/en/language/types.xml:1.122 Sat Jun 21 12:06:20 2003
+++ phpdoc/en/language/types.xml Fri Jun 27 17:27:30 2003
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.122 $ -->
+<!-- $Revision: 1.123 $ -->
<chapter id="language.types">
<title>Types</title>
@@ -1317,12 +1317,8 @@
<para>
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 <literal>0</literal>. If no integer indices
- exist yet, the key will be <literal>0</literal> (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.
<informalexample>
<programlisting role="php">
<![CDATA[
@@ -1337,6 +1333,16 @@
</programlisting>
</informalexample>
</para>
+ <warning>
+ <simpara>
+ 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 (<literal>0</literal>). Before, the new
+ index would have been set to the largest existing key + 1,
+ the same as positive indices are.
+ </simpara>
+ </warning>
<para>
Using &true; as a key will evaluate to <type>integer</type>
<literal>1</literal> as key. Using &false; as a key will evaluate
@@ -1397,13 +1403,22 @@
<para>
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
- <literal>0</literal>. If no integer indices exist yet, the key
- will be <literal>0</literal> (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 <literal>0</literal>
+ (zero). If you specify a key that already has a value assigned
+ to it, that value will be overwritten.
+ </para>
+ <para>
+ <warning>
+ <simpara>
+ 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 (<literal>0</literal>). Before, the new
+ index would have been set to the largest existing key + 1,
+ the same as positive indices are.
+ </simpara>
+ </warning>
</para>
<para>
Note that the maximum integer key used for this <emphasis>need
--
PHP Documentation Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php