added note to explain unset() doesn't change maximum index value.

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@131464 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Rui Hirokawa 2003-06-14 04:00:55 +00:00
parent d875c463b3
commit 5933a0d874

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.114 $ -->
<!-- $Revision: 1.115 $ -->
<chapter id="language.types">
<title>Types</title>
@ -1391,6 +1391,26 @@ unset($arr); // This deletes the whole array
</programlisting>
</informalexample>
</para>
<note>
<para>
If you omit a key, the maximum of the integer-indices is taken, and
the new key will be that maximum + 1.
Note that the maximum is same when the element having
maximum-index was cleared using <function>unset</function> function.
<informalexample>
<programlisting role="php">
<![CDATA[
<?php
$a = array("orange","apple","banana");
unset($a[2]); // clear $a[2]
$a[] = 'carrot'; // assign a new value without key
var_dump($a); // output: array(0 => 'orange', 1 => 'apple', 3 => 'carrot')
?>
]]>
</programlisting>
</informalexample>
</para>
</note>
</sect3>
</sect2><!-- end syntax -->