cvs: phpdoc-zh /reference/array/functions arsort.xml asort.xml compact.xml count.xml current.xml each.xml end.xml
| From: | Dallas Thunder | Date: | Fri, 13 Sep 2002 03:20:17 +0000 |
| Subject: | cvs: phpdoc-zh /reference/array/functions arsort.xml asort.xml compact.xml count.xml current.xml each.xml end.xml | ||
| Groups: | php.doc.zh | ||
| Request: | Send a blank email to doc-zh+get-551@lists.php.net to get a copy of this message | ||
dallas Thu Sep 12 23:20:17 2002 EDT
Added files:
/phpdoc-zh/reference/array/functions arsort.xml asort.xml
compact.xml count.xml
current.xml each.xml end.xml
Log:
Translation completed.
Index: phpdoc-zh/reference/array/functions/arsort.xml +++ phpdoc-zh/reference/array/functions/arsort.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <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[ $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 --> Index: phpdoc-zh/reference/array/functions/asort.xml +++ phpdoc-zh/reference/array/functions/asort.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $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 --> Index: phpdoc-zh/reference/array/functions/compact.xml +++ phpdoc-zh/reference/array/functions/compact.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.compact"> <refnamediv> <refname>compact</refname> <refpurpose> ½¨Á¢Ò»¸öÊý×飬°üÀ¨±äÁ¿ÃûºÍËüÃǵÄÖµ </refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>array</type><methodname>compact</methodname> <methodparam><type>mixed</type><parameter>varname</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> </methodsynopsis> <para> <function>compact</function> ½ÓÊܿɱäµÄ²ÎÊýÊýÄ¿¡£Ã¿¸ö²ÎÊý¿ÉÒÔÊÇÒ»¸ö°üÀ¨±äÁ¿ÃûµÄ×Ö·û´®»òÕßÊÇÒ»¸ö°üº¬±äÁ¿ÃûµÄÊý×飬¸ÃÊý×éÖл¹¿ÉÒÔ°üº¬ÆäËüµ¥ÔªÄÚÈÝΪ±äÁ¿ÃûµÄÊý×飬 <function>compact</function> ¿ÉÒԵݹ鴦Àí¡£ </para> <para> ¶Ôÿ¸ö²ÎÊý£¬<function>compact</function> ÔÚµ±Ç°µÄ·ûºÅ±íÖвéÕҸñäÁ¿Ãû²¢½«ËüÌí¼Óµ½Êä³öµÄÊý×éÖУ¬±äÁ¿Ãû³ÉΪ¼üÃû¶ø±äÁ¿µÄÄÚÈݳÉΪ¸Ã¼üµÄÖµ¡£¼òµ¥Ëµ£¬Ëü×öµÄÊÂºÍ <function>extract</function> ÕýºÃÏà·´¡£·µ»Ø½«ËùÓбäÁ¿Ìí¼Ó½øÈ¥ºóµÄÊý×é¡£ </para> <para> ÈκÎûÓÐÉ趨Ϊ±äÁ¿ÃûµÄ×Ö·û´®¶¼±»Ìø¹ý¡£ </para> <para> <example> <title><function>compact</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ $city = "San Francisco"; $state = "CA"; $event = "SIGGRAPH"; $location_vars = array ("city", "state"); $result = compact ("event", "nothing_here", $location_vars); ]]> </programlisting> <para> ¾¹ý´¦Àíºó£¬<varname>$result</varname> Ϊ£º <screen role="php"> <![CDATA[ Array ( [event] => SIGGRAPH [city] => San Francisco [state] => CA ) ]]> </screen> </para> </example> </para> <para> ²Î¼û <function>extract</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 --> Index: phpdoc-zh/reference/array/functions/count.xml +++ phpdoc-zh/reference/array/functions/count.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.count"> <refnamediv> <refname>count</refname> <refpurpose>ͳ¼Æ±äÁ¿Öеĵ¥ÔªÊýÄ¿</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>int</type><methodname>count</methodname> <methodparam><type>mixed</type><parameter>var</parameter></methodparam> </methodsynopsis> <para> ·µ»Ø <parameter>var</parameter> Öеĵ¥ÔªÊýÄ¿£¬Í¨³£ÊÇÒ»¸ö <type>array</type>£¨ÈÎºÎÆäËüÀàÐͶ¼Ö»ÓÐÒ»¸öµ¥Ôª£©¡£ </para> <para> Èç¹û <parameter>var</parameter> ²»ÊÇÊý×éÀàÐÍ£¬½«·µ»Ø <literal>1</literal>£¨ÀýÍ⣺<literal>count(&null;)</literal> µÄ½á¹ûÊÇ <literal>0</literal>£©¡£ </para> <warning> <para> <function>count</function> ¶ÔûÓгõʼ»¯µÄ±äÁ¿·µ»Ø 0£¬µ«¶ÔÓÚ¿ÕµÄÊý×éÒ²»á·µ»Ø 0¡£Óà <function>isset</function> À´²âÊÔ±äÁ¿ÊÇ·ñÒѾ³õʼ»¯¡£ </para> </warning> <para> Çë²Î¿¼ÊÖ²áÖÐ<link linkend="language.types.array">Êý×é</link>Ò»½ÚÖйØÓÚÔõÑùÔÚ PHP ÖÐʵÏÖºÍʹÓÃÊý×éµÄÏêϸ½âÊÍ¡£ </para> <para> <example> <title><function>count</function> Àý×Ó</title> <programlisting role="php"> <!-- TODO: examples about count(null), count(false), count(object).. --> <![CDATA[ $a[0] = 1; $a[1] = 3; $a[2] = 5; $result = count ($a); // $result == 3 $b[0] = 7; $b[5] = 9; $b[10] = 11; $result = count ($b); // $result == 3; ]]> </programlisting> </example> </para> <note> <para> <function>sizeof</function> º¯ÊýÊÇ <function>count</function> µÄ<link linkend="aliases">±ðÃû</link>¡£ </para> </note> <para> ²Î¼û <function>is_array</function>£¬<function>isset</function> ºÍ <function>strlen</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 --> Index: phpdoc-zh/reference/array/functions/current.xml +++ phpdoc-zh/reference/array/functions/current.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.current"> <refnamediv> <refname>current</refname> <refpurpose>·µ»ØÊý×éÖеĵ±Ç°µ¥Ôª</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>mixed</type><methodname>current</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> ÿ¸öÊý×éÖж¼ÓÐÒ»¸öÄÚ²¿µÄÖ¸ÕëÖ¸ÏòËü¡°µ±Ç°µÄ¡±µ¥Ôª£¬³õʼָÏò²åÈëµ½Êý×éÖеĵÚÒ»¸öµ¥Ôª¡£ </para> <para> <function>current</function> º¯Êý·µ»Øµ±Ç°±»ÄÚ²¿Ö¸ÕëÖ¸ÏòµÄÊý×éµ¥Ôª£¬²¢²»Òƶ¯Ö¸Õë¡£Èç¹ûÄÚ²¿Ö¸ÕëÖ¸Ïò³¬³öÁ˵¥ÔªÁбíµÄÄ©¶Ë£¬<function>current</function> ·µ»Ø &false;¡£ <warning> <para> Èç¹ûÊý×é°üº¬Óпյĵ¥Ôª£¨0 »òÕß ""£¬¿Õ×Ö·û´®£©Ôò±¾º¯ÊýÔÚÅöµ½Õâ¸öµ¥ÔªÊ±Ò²·µ»Ø &false;¡£ÕâʹµÃÓà <function>current</function> ²»¿ÉÄÜÅжÏÊÇ·ñµ½ÁË´ËÊý×éÁбíµÄÄ©¶Ë¡£ÒªÕýÈ·±éÀú¿ÉÄܺ¬Óпյ¥ÔªµÄÊý×飬Óà <function>each</function> º¯Êý¡£ </para> </warning> </para> <para> ²Î¼û <function>end</function>£¬<function>next</function>£¬<function>prev</function> ºÍ <function>reset</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 --> Index: phpdoc-zh/reference/array/functions/each.xml +++ phpdoc-zh/reference/array/functions/each.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> <refentry id="function.each"> <refnamediv> <refname>each</refname> <refpurpose> ·µ»ØÊý×éÖе±Ç°µÄ¼üÖµ¶Ô²¢½«Êý×éÖ¸ÕëÏòÇ°ÒÆ¶¯Ò»²½ </refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>array</type><methodname>each</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> ·µ»Ø <parameter>array</parameter> Êý×éÖе±Ç°Ö¸ÕëλÖõļüÖµ¶Ô²¢ÏòÇ°ÒÆ¶¯Êý×éÖ¸Õë¡£¼üÖµ¶Ô±»·µ»ØÎªËĸöµ¥ÔªµÄÊý×飬¼üÃûΪ <emphasis>0</emphasis>£¬<emphasis>1</emphasis>£¬<emphasis>key</emphasis> ºÍ <emphasis>value</emphasis>¡£µ¥Ôª <emphasis>0</emphasis> ºÍ <emphasis>key</emphasis> °üº¬ÓÐÊý×éµ¥ÔªµÄ¼üÃû£¬<emphasis>1</emphasis> ºÍ <emphasis>value</emphasis> °üº¬ÓÐÊý¾Ý¡£ </para> <para> Èç¹ûÄÚ²¿Ö¸ÕëÔ½¹ýÁËÊý×éµÄÄ©¶Ë£¬Ôò <function>each</function> ·µ»Ø &false;¡£ </para> <para> <example> <title><function>each</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ $foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese"); $bar = each ($foo); ]]> </programlisting> <para> <varname>$bar</varname> ÏÖÔÚ°üº¬ÓÐÈçϵļü£¯Öµ¶Ô£º <itemizedlist spacing="compact"> <listitem><simpara>0 => 0</simpara></listitem> <listitem><simpara>1 => 'bob'</simpara></listitem> <listitem><simpara>key => 0</simpara></listitem> <listitem><simpara>value => 'bob'</simpara></listitem> </itemizedlist> <programlisting role="php"> <![CDATA[ $foo = array ("Robert" => "Bob", "Seppo" => "Sepi"); $bar = each ($foo); ]]> </programlisting> </para> <para> <varname>$bar</varname> ÏÖÔÚ°üº¬ÓÐÈçϵļü£¯Öµ¶Ô£º <itemizedlist spacing="compact"> <listitem><simpara>0 => 'Robert'</simpara></listitem> <listitem><simpara>1 => 'Bob'</simpara></listitem> <listitem><simpara>key => 'Robert'</simpara></listitem> <listitem><simpara>value => 'Bob'</simpara></listitem> </itemizedlist> </para> </example> </para> <para> <function>each</function> ¾³£ºÍ <function>list</function> ½áºÏʹÓÃÀ´±éÀúÊý×飬ÀýÈç <varname>$_POST</varname>£º <example> <title> Óà <function>each</function> ±éÀú <varname>$_POST</varname>£º </title> <programlisting role="php"> <![CDATA[ echo "Values submitted via POST method:<br />\n"; reset ($_POST); while (list ($key, $val) = each ($_POST)) { echo "$key => $val<br />\n"; } ]]> </programlisting> </example> </para> <para> ÔÚÖ´ÐÐ <function>each</function> Ö®ºó£¬Êý×éÖ¸Õ뽫ͣÁôÔÚÊý×éÖеÄÏÂÒ»¸öµ¥Ôª»òÕßµ±Åöµ½Êý×é½áβʱͣÁôÔÚ×îºóÒ»¸öµ¥Ôª¡£Èç¹ûÒªÔÙÓà each ±éÀúÊý×飬±ØÐëʹÓà <function>reset</function>¡£ </para> <para> ²Î¼û <function>key</function>£¬<function>list</function>£¬<function>current</function>£¬<function>reset</function>£¬<function>next</function>£¬<function>prev</function> ºÍ <function>foreach</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 --> Index: phpdoc-zh/reference/array/functions/end.xml +++ phpdoc-zh/reference/array/functions/end.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.end"> <refnamediv> <refname>end</refname> <refpurpose> ½«Êý×éµÄÄÚ²¿Ö¸ÕëÖ¸Ïò×îºóÒ»¸öµ¥Ôª </refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>mixed</type><methodname>end</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> <function>end</function> ½« <parameter>array</parameter> µÄÄÚ²¿Ö¸ÕëÒÆ¶¯µ½×îºóÒ»¸öµ¥Ôª£¬²¢·µ»Ø¸Ãµ¥Ôª¡£ </para> <para> <example> <title>¼òµ¥µÄ <function>end</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ <?php $fruits = array('apple','banana','cranberry'); print end($fruits); // cranberry ?> ]]> </programlisting> </example> </para> <para> ²Î¼û <function>current</function>£¬<function>each</function>£¬<function>next</function> ºÍ <function>reset</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 -->
Index: phpdoc-zh/reference/array/functions/arsort.xml +++ phpdoc-zh/reference/array/functions/arsort.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <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[ $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 --> Index: phpdoc-zh/reference/array/functions/asort.xml +++ phpdoc-zh/reference/array/functions/asort.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $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 --> Index: phpdoc-zh/reference/array/functions/compact.xml +++ phpdoc-zh/reference/array/functions/compact.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.compact"> <refnamediv> <refname>compact</refname> <refpurpose> ½¨Á¢Ò»¸öÊý×飬°üÀ¨±äÁ¿ÃûºÍËüÃǵÄÖµ </refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>array</type><methodname>compact</methodname> <methodparam><type>mixed</type><parameter>varname</parameter></methodparam> <methodparam choice="opt"><type>mixed</type><parameter>...</parameter></methodparam> </methodsynopsis> <para> <function>compact</function> ½ÓÊܿɱäµÄ²ÎÊýÊýÄ¿¡£Ã¿¸ö²ÎÊý¿ÉÒÔÊÇÒ»¸ö°üÀ¨±äÁ¿ÃûµÄ×Ö·û´®»òÕßÊÇÒ»¸ö°üº¬±äÁ¿ÃûµÄÊý×飬¸ÃÊý×éÖл¹¿ÉÒÔ°üº¬ÆäËüµ¥ÔªÄÚÈÝΪ±äÁ¿ÃûµÄÊý×飬 <function>compact</function> ¿ÉÒԵݹ鴦Àí¡£ </para> <para> ¶Ôÿ¸ö²ÎÊý£¬<function>compact</function> ÔÚµ±Ç°µÄ·ûºÅ±íÖвéÕҸñäÁ¿Ãû²¢½«ËüÌí¼Óµ½Êä³öµÄÊý×éÖУ¬±äÁ¿Ãû³ÉΪ¼üÃû¶ø±äÁ¿µÄÄÚÈݳÉΪ¸Ã¼üµÄÖµ¡£¼òµ¥Ëµ£¬Ëü×öµÄÊÂºÍ <function>extract</function> ÕýºÃÏà·´¡£·µ»Ø½«ËùÓбäÁ¿Ìí¼Ó½øÈ¥ºóµÄÊý×é¡£ </para> <para> ÈκÎûÓÐÉ趨Ϊ±äÁ¿ÃûµÄ×Ö·û´®¶¼±»Ìø¹ý¡£ </para> <para> <example> <title><function>compact</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ $city = "San Francisco"; $state = "CA"; $event = "SIGGRAPH"; $location_vars = array ("city", "state"); $result = compact ("event", "nothing_here", $location_vars); ]]> </programlisting> <para> ¾¹ý´¦Àíºó£¬<varname>$result</varname> Ϊ£º <screen role="php"> <![CDATA[ Array ( [event] => SIGGRAPH [city] => San Francisco [state] => CA ) ]]> </screen> </para> </example> </para> <para> ²Î¼û <function>extract</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 --> Index: phpdoc-zh/reference/array/functions/count.xml +++ phpdoc-zh/reference/array/functions/count.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.count"> <refnamediv> <refname>count</refname> <refpurpose>ͳ¼Æ±äÁ¿Öеĵ¥ÔªÊýÄ¿</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>int</type><methodname>count</methodname> <methodparam><type>mixed</type><parameter>var</parameter></methodparam> </methodsynopsis> <para> ·µ»Ø <parameter>var</parameter> Öеĵ¥ÔªÊýÄ¿£¬Í¨³£ÊÇÒ»¸ö <type>array</type>£¨ÈÎºÎÆäËüÀàÐͶ¼Ö»ÓÐÒ»¸öµ¥Ôª£©¡£ </para> <para> Èç¹û <parameter>var</parameter> ²»ÊÇÊý×éÀàÐÍ£¬½«·µ»Ø <literal>1</literal>£¨ÀýÍ⣺<literal>count(&null;)</literal> µÄ½á¹ûÊÇ <literal>0</literal>£©¡£ </para> <warning> <para> <function>count</function> ¶ÔûÓгõʼ»¯µÄ±äÁ¿·µ»Ø 0£¬µ«¶ÔÓÚ¿ÕµÄÊý×éÒ²»á·µ»Ø 0¡£Óà <function>isset</function> À´²âÊÔ±äÁ¿ÊÇ·ñÒѾ³õʼ»¯¡£ </para> </warning> <para> Çë²Î¿¼ÊÖ²áÖÐ<link linkend="language.types.array">Êý×é</link>Ò»½ÚÖйØÓÚÔõÑùÔÚ PHP ÖÐʵÏÖºÍʹÓÃÊý×éµÄÏêϸ½âÊÍ¡£ </para> <para> <example> <title><function>count</function> Àý×Ó</title> <programlisting role="php"> <!-- TODO: examples about count(null), count(false), count(object).. --> <![CDATA[ $a[0] = 1; $a[1] = 3; $a[2] = 5; $result = count ($a); // $result == 3 $b[0] = 7; $b[5] = 9; $b[10] = 11; $result = count ($b); // $result == 3; ]]> </programlisting> </example> </para> <note> <para> <function>sizeof</function> º¯ÊýÊÇ <function>count</function> µÄ<link linkend="aliases">±ðÃû</link>¡£ </para> </note> <para> ²Î¼û <function>is_array</function>£¬<function>isset</function> ºÍ <function>strlen</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 --> Index: phpdoc-zh/reference/array/functions/current.xml +++ phpdoc-zh/reference/array/functions/current.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.current"> <refnamediv> <refname>current</refname> <refpurpose>·µ»ØÊý×éÖеĵ±Ç°µ¥Ôª</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>mixed</type><methodname>current</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> ÿ¸öÊý×éÖж¼ÓÐÒ»¸öÄÚ²¿µÄÖ¸ÕëÖ¸ÏòËü¡°µ±Ç°µÄ¡±µ¥Ôª£¬³õʼָÏò²åÈëµ½Êý×éÖеĵÚÒ»¸öµ¥Ôª¡£ </para> <para> <function>current</function> º¯Êý·µ»Øµ±Ç°±»ÄÚ²¿Ö¸ÕëÖ¸ÏòµÄÊý×éµ¥Ôª£¬²¢²»Òƶ¯Ö¸Õë¡£Èç¹ûÄÚ²¿Ö¸ÕëÖ¸Ïò³¬³öÁ˵¥ÔªÁбíµÄÄ©¶Ë£¬<function>current</function> ·µ»Ø &false;¡£ <warning> <para> Èç¹ûÊý×é°üº¬Óпյĵ¥Ôª£¨0 »òÕß ""£¬¿Õ×Ö·û´®£©Ôò±¾º¯ÊýÔÚÅöµ½Õâ¸öµ¥ÔªÊ±Ò²·µ»Ø &false;¡£ÕâʹµÃÓà <function>current</function> ²»¿ÉÄÜÅжÏÊÇ·ñµ½ÁË´ËÊý×éÁбíµÄÄ©¶Ë¡£ÒªÕýÈ·±éÀú¿ÉÄܺ¬Óпյ¥ÔªµÄÊý×飬Óà <function>each</function> º¯Êý¡£ </para> </warning> </para> <para> ²Î¼û <function>end</function>£¬<function>next</function>£¬<function>prev</function> ºÍ <function>reset</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 --> Index: phpdoc-zh/reference/array/functions/each.xml +++ phpdoc-zh/reference/array/functions/each.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> <refentry id="function.each"> <refnamediv> <refname>each</refname> <refpurpose> ·µ»ØÊý×éÖе±Ç°µÄ¼üÖµ¶Ô²¢½«Êý×éÖ¸ÕëÏòÇ°ÒÆ¶¯Ò»²½ </refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>array</type><methodname>each</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> ·µ»Ø <parameter>array</parameter> Êý×éÖе±Ç°Ö¸ÕëλÖõļüÖµ¶Ô²¢ÏòÇ°ÒÆ¶¯Êý×éÖ¸Õë¡£¼üÖµ¶Ô±»·µ»ØÎªËĸöµ¥ÔªµÄÊý×飬¼üÃûΪ <emphasis>0</emphasis>£¬<emphasis>1</emphasis>£¬<emphasis>key</emphasis> ºÍ <emphasis>value</emphasis>¡£µ¥Ôª <emphasis>0</emphasis> ºÍ <emphasis>key</emphasis> °üº¬ÓÐÊý×éµ¥ÔªµÄ¼üÃû£¬<emphasis>1</emphasis> ºÍ <emphasis>value</emphasis> °üº¬ÓÐÊý¾Ý¡£ </para> <para> Èç¹ûÄÚ²¿Ö¸ÕëÔ½¹ýÁËÊý×éµÄÄ©¶Ë£¬Ôò <function>each</function> ·µ»Ø &false;¡£ </para> <para> <example> <title><function>each</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ $foo = array ("bob", "fred", "jussi", "jouni", "egon", "marliese"); $bar = each ($foo); ]]> </programlisting> <para> <varname>$bar</varname> ÏÖÔÚ°üº¬ÓÐÈçϵļü£¯Öµ¶Ô£º <itemizedlist spacing="compact"> <listitem><simpara>0 => 0</simpara></listitem> <listitem><simpara>1 => 'bob'</simpara></listitem> <listitem><simpara>key => 0</simpara></listitem> <listitem><simpara>value => 'bob'</simpara></listitem> </itemizedlist> <programlisting role="php"> <![CDATA[ $foo = array ("Robert" => "Bob", "Seppo" => "Sepi"); $bar = each ($foo); ]]> </programlisting> </para> <para> <varname>$bar</varname> ÏÖÔÚ°üº¬ÓÐÈçϵļü£¯Öµ¶Ô£º <itemizedlist spacing="compact"> <listitem><simpara>0 => 'Robert'</simpara></listitem> <listitem><simpara>1 => 'Bob'</simpara></listitem> <listitem><simpara>key => 'Robert'</simpara></listitem> <listitem><simpara>value => 'Bob'</simpara></listitem> </itemizedlist> </para> </example> </para> <para> <function>each</function> ¾³£ºÍ <function>list</function> ½áºÏʹÓÃÀ´±éÀúÊý×飬ÀýÈç <varname>$_POST</varname>£º <example> <title> Óà <function>each</function> ±éÀú <varname>$_POST</varname>£º </title> <programlisting role="php"> <![CDATA[ echo "Values submitted via POST method:<br />\n"; reset ($_POST); while (list ($key, $val) = each ($_POST)) { echo "$key => $val<br />\n"; } ]]> </programlisting> </example> </para> <para> ÔÚÖ´ÐÐ <function>each</function> Ö®ºó£¬Êý×éÖ¸Õ뽫ͣÁôÔÚÊý×éÖеÄÏÂÒ»¸öµ¥Ôª»òÕßµ±Åöµ½Êý×é½áβʱͣÁôÔÚ×îºóÒ»¸öµ¥Ôª¡£Èç¹ûÒªÔÙÓà each ±éÀúÊý×飬±ØÐëʹÓà <function>reset</function>¡£ </para> <para> ²Î¼û <function>key</function>£¬<function>list</function>£¬<function>current</function>£¬<function>reset</function>£¬<function>next</function>£¬<function>prev</function> ºÍ <function>foreach</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 --> Index: phpdoc-zh/reference/array/functions/end.xml +++ phpdoc-zh/reference/array/functions/end.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.end"> <refnamediv> <refname>end</refname> <refpurpose> ½«Êý×éµÄÄÚ²¿Ö¸ÕëÖ¸Ïò×îºóÒ»¸öµ¥Ôª </refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>mixed</type><methodname>end</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> <function>end</function> ½« <parameter>array</parameter> µÄÄÚ²¿Ö¸ÕëÒÆ¶¯µ½×îºóÒ»¸öµ¥Ôª£¬²¢·µ»Ø¸Ãµ¥Ôª¡£ </para> <para> <example> <title>¼òµ¥µÄ <function>end</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ <?php $fruits = array('apple','banana','cranberry'); print end($fruits); // cranberry ?> ]]> </programlisting> </example> </para> <para> ²Î¼û <function>current</function>£¬<function>each</function>£¬<function>next</function> ºÍ <function>reset</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 -->