1
0
mirror of https://github.com/php/doc-ja.git synced 2026-04-28 10:33:19 +02:00
Files
archived-doc-ja/reference/array/functions/arsort.xml
T
Yu Watanabe b6dd415e04 sync to en tree.
git-svn-id: https://svn.php.net/repository/phpdoc/ja/trunk@134975 c90b9560-bf6c-de11-be94-00142212c4b1
2003-07-13 13:21:38 +00:00

86 lines
2.4 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!-- $Revision: 1.3 $ -->
<!-- sync: 1.6 -->
<refentry id="function.arsort">
<refnamediv>
<refname>arsort</refname>
<refpurpose>
連想キーと要素との関係を維持しつつ配列を逆順にソートする
</refpurpose>
</refnamediv>
<refsect1>
<title>説明</title>
<methodsynopsis>
<type>void</type><methodname>arsort</methodname>
<methodparam><type>array</type><parameter>array</parameter></methodparam>
<methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam>
</methodsynopsis>
<para>
この関数は、連想配列において各配列のキーと要素との関係を維持しつ
つソートを行います。この関数は、主に実際の要素の並び方が重要であ
る連想配列をソートするために使われます。
</para>
<example>
<title><function>arsort</function>の例</title>
<programlisting role="php">
<![CDATA[
<?php
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
arsort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
echo "$key = $val\n";
}
?>
]]>
</programlisting>
<para>
この例は、以下のように出力されます。
<screen>
<![CDATA[
a = orange
d = lemon
b = banana
c = apple
]]>
</screen>
</para>
</example>
<para>
fruitsはアルファベットの逆順にソートされ、各要素とキーとの関係は
維持されます。
</para>
<para>
オプションのパラメータ<parameter>sort_flags</parameter>によりソー
トの動作を修正可能です。詳細については、<function>sort</function>
を参照下さい。
</para>
<para>
<function>asort</function>, <function>rsort</function>,
<function>ksort</function>, <function>sort</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
-->