jan Wed Dec 12 17:08:29 2001 EDT
Modified files:
/phpdoc/en/language types.xml
Log:
fix for #11937. pointing out that unset() will not
cause a reindexing of an array when deleting a key.
Index: phpdoc/en/language/types.xml
diff -u phpdoc/en/language/types.xml:1.68 phpdoc/en/language/types.xml:1.69
--- phpdoc/en/language/types.xml:1.68 Wed Dec 12 15:47:39 2001
+++ phpdoc/en/language/types.xml Wed Dec 12 17:08:28 2001
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.68 $ -->
+<!-- $Revision: 1.69 $ -->
<chapter id="language.types">
<title>Types</title>
@@ -1167,11 +1167,33 @@
with arrays, see the <link linkend="ref.array">array-functions</link>
section.
</para>
+ <note>
+ <para>
+ The <function>unset</function> function allows unsetting keys of an
+ array. Be aware that the array will NOT be reindexed.
+ <informalexample>
+ <programlisting role="php">
+<![CDATA[
+$a = array( 1 => 'one', 2 => 'two', 3 => 'three' );
+unset( $a[2] );
+/* will produce an array that would have been defined as
+ $a = array( 1=>'one', 3=>'three');
+ and NOT
+ $a = array( 1 => 'one', 2 => 'three');
+*/
+]]>
+ </programlisting>
+ </informalexample>
+
+ </para>
+ </note>
<para>
The <link linkend="control-structures.foreach">foreach</link>
control structure exists specificly for arrays. It
provides an easy way to traverse an array.
</para>
+
+
</sect2>
<sect2 id="language.types.array.donts">