mirror of
https://github.com/php/doc-ja.git
synced 2026-03-26 08:02:15 +01:00
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@222583 c90b9560-bf6c-de11-be94-00142212c4b1
100 lines
2.5 KiB
XML
100 lines
2.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<!-- $Revision: 1.6 $ -->
|
|
<!-- EN-Revision: 1.10 Maintainer: hirokawa Status: ready -->
|
|
<refentry id="function.array-reverse">
|
|
<refnamediv>
|
|
<refname>array_reverse</refname>
|
|
<refpurpose>要素を逆順にした配列を返す</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>説明</title>
|
|
<methodsynopsis>
|
|
<type>array</type><methodname>array_reverse</methodname>
|
|
<methodparam><type>array</type><parameter>array</parameter></methodparam>
|
|
<methodparam choice="opt"><type>bool</type><parameter>preserve_keys</parameter></methodparam>
|
|
</methodsynopsis>
|
|
<para>
|
|
<function>array_reverse</function> は、<parameter>array</parameter>
|
|
を引数とし、要素の順番を逆にした新しい配列を返します。
|
|
この時、 <parameter>preserve_keys</parameter> が &true;
|
|
の場合はキーが保持されます。
|
|
</para>
|
|
<para>
|
|
<example>
|
|
<title><function>array_reverse</function> の例</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$input = array("php", 4.0, array("green", "red"));
|
|
$result = array_reverse($input);
|
|
$result_keyed = array_reverse($input, true);
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
<para>
|
|
この例において、<varname>$result</varname> と
|
|
<varname>$result_keyed</varname> は同じ要素をもちますが、
|
|
キーが違うことに注意してください。
|
|
<varname>$result</varname> と <varname>$result_keyed</varname>
|
|
の出力は次のようになります:
|
|
</para>
|
|
<screen role="php">
|
|
<![CDATA[
|
|
Array
|
|
(
|
|
[0] => Array
|
|
(
|
|
[0] => green
|
|
[1] => red
|
|
)
|
|
|
|
[1] => 4
|
|
[2] => php
|
|
)
|
|
Array
|
|
(
|
|
[2] => Array
|
|
(
|
|
[0] => green
|
|
[1] => red
|
|
)
|
|
|
|
[1] => 4
|
|
[0] => php
|
|
)
|
|
]]>
|
|
</screen>
|
|
</example>
|
|
</para>
|
|
<note>
|
|
<para>
|
|
2 番目のパラメータは、PHP 4.0.3 で追加されました。
|
|
</para>
|
|
</note>
|
|
<para>
|
|
<function>array_flip</function> も参照ください。
|
|
</para>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|