mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 00:48:54 +00:00
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:
parent
d875c463b3
commit
5933a0d874
1 changed files with 21 additions and 1 deletions
|
@ -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 -->
|
||||
|
||||
|
|
Loading…
Reference in a new issue