1
0
mirror of https://github.com/php/doc-zh.git synced 2026-04-28 18:53:12 +02:00
Files
archived-doc-zh/reference/array/functions/asort.xml
T
Dallas Wang 64071f2fba Literal fixes.
git-svn-id: https://svn.php.net/repository/phpdoc/zh/trunk@95699 c90b9560-bf6c-de11-be94-00142212c4b1
2002-09-14 18:51:42 +00:00

76 lines
2.0 KiB
XML
Executable File
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?xml version="1.0" encoding="gb2312"?>
<!-- $Revision: 1.2 $ -->
<!-- $Author: dallas $ -->
<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready -->
<refentry id="function.asort">
<refnamediv>
<refname>asort</refname>
<refpurpose>对数组进行排序并保持索引关系</refpurpose>
</refnamediv>
<refsect1>
<title>说明</title>
<methodsynopsis>
<type>void</type><methodname>asort</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>asort</function> 例子</title>
<programlisting role="php">
<![CDATA[
$fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple");
asort ($fruits);
reset ($fruits);
while (list ($key, $val) = each ($fruits)) {
echo "$key = $val\n";
}
]]>
</programlisting>
<para>
本例显示为:
<screen>
<![CDATA[
c = apple
b = banana
d = lemon
a = orange
]]>
</screen>
</para>
</example>
<para>
fruits 被按照字母顺序排序,并且单元的索引关系不变。
</para>
<para>
可以用可选的参数 <parameter>sort_flags</parameter> 改变排序的行为,详情见 <function>sort</function>
</para>
<para>
参见 <function>arsort</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
-->