mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-16 08:58:56 +00:00
document preserve_keys param to array_reverse
git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@40008 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
parent
3e67bfa595
commit
6d1b6f26ce
1 changed files with 12 additions and 2 deletions
|
@ -751,12 +751,14 @@ print $input[$rand_keys[1]]."\n";
|
|||
<funcprototype>
|
||||
<funcdef>array <function>array_reverse</function></funcdef>
|
||||
<paramdef>array <parameter>array</parameter></paramdef>
|
||||
<paramdef>bool <parameter><optional>preserve_keys</optional></parameter></paramdef>
|
||||
</funcprototype>
|
||||
</funcsynopsis>
|
||||
<para>
|
||||
<function>Array_reverse</function> takes input
|
||||
<parameter>array</parameter> and returns a new array with the
|
||||
order of the elements reversed.
|
||||
order of the elements reversed, preserving the keys if
|
||||
<parameter>preserve_keys</parameter> is true.
|
||||
</para>
|
||||
<para>
|
||||
<example>
|
||||
|
@ -764,13 +766,21 @@ print $input[$rand_keys[1]]."\n";
|
|||
<programlisting role="php">
|
||||
$input = array ("php", 4.0, array ("green", "red"));
|
||||
$result = array_reverse ($input);
|
||||
$result_keyed = array_reverse ($input, true);
|
||||
</programlisting>
|
||||
</example>
|
||||
</para>
|
||||
<para>
|
||||
This makes <varname>$result</varname> have <literal>array
|
||||
(array ("green", "red"), 4.0, "php")</literal>.
|
||||
(array ("green", "red"), 4.0, "php")</literal>. But
|
||||
<varname>$result2[0]</varname> is still
|
||||
<literal>"php"</literal>.
|
||||
</para>
|
||||
<note>
|
||||
<para>
|
||||
The second parameter was added in PHP 4.0.3.
|
||||
</para>
|
||||
</note>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
|
|
Loading…
Reference in a new issue