cvs: phpdoc-zh /reference/array/functions in-array.xml key.xml krsort.xml ksort.xml list.xml

From: Date: Fri, 13 Sep 2002 20:57:17 +0000
Subject: cvs: phpdoc-zh /reference/array/functions in-array.xml key.xml krsort.xml ksort.xml list.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-568@lists.php.net to get a copy of this message
dallas Fri Sep 13 16:57:17 2002 EDT Added files: /phpdoc-zh/reference/array/functions in-array.xml key.xml krsort.xml ksort.xml list.xml Log: Translation completed.

Index: phpdoc-zh/reference/array/functions/in-array.xml +++ phpdoc-zh/reference/array/functions/in-array.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.in-array"> <refnamediv> <refname>in_array</refname> <refpurpose>Èç¹ûÊý×éÖдæÔÚ¸ÃÖµÔò·µ»Ø &true;</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>bool</type><methodname>in_array</methodname> <methodparam><type>mixed</type><parameter>needle</parameter></methodparam> <methodparam><type>array</type><parameter>haystack</parameter></methodparam> <methodparam choice="opt"><type>bool</type><parameter>strict</parameter></methodparam> </methodsynopsis> <para> ÔÚ <parameter>haystack</parameter> ÖÐËÑË÷ <parameter>needle</parameter>£¬Èç¹ûÕÒµ½Ôò·µ»Ø &true;£¬·ñÔò·µ»Ø &false;¡£ </para> <para> Èç¹ûµÚÈý¸ö²ÎÊý <parameter>strict</parameter> µÄֵΪ &true; Ôò <function>in_array</function> º¯Êý»¹»á¼ì²é <parameter>needle</parameter> µÄ<link linkend="language.types">ÀàÐÍ</link>ÊÇ·ñºÍ <parameter>haystack</parameter> ÖеÄÏàͬ¡£ </para> <note> <para> Èç¹û <parameter>needle</parameter> ÊÇ×Ö·û´®£¬Ôò±È½ÏÊÇÇø·Ö´óСдµÄ¡£ </para> </note> <note> <para> ÔÚ PHP °æ±¾ 4.2.0 ֮ǰ£¬<parameter>needle</parameter> ²»ÔÊÐíÊÇÒ»¸öÊý×é¡£ </para> </note> <para> <example> <title><function>in_array</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ $os = array ("Mac", "NT", "Irix", "Linux"); if (in_array ("Irix", $os)) { print "Got Irix"; } if (in_array ("mac", $os)) { print "Got mac"; } ]]> </programlisting> <para> µÚ¶þ¸öÌõ¼þʧ°Ü£¬ÒòΪ <function>in_array</function> ÊÇÇø·Ö´óСдµÄ£¬ËùÒÔÒÔÉϳÌÐòÏÔʾΪ£º <screen role="php"> <![CDATA[ Got Irix ]]> </screen> </para> </example> </para> <para> <example> <title><function>in_array</function> ÑϸñÀàÐͼì²éÀý×Ó</title> <programlisting role="php"> <![CDATA[ <?php $a = array('1.10', 12.4, 1.13); if (in_array('12.4', $a, TRUE)) echo "'12.4' found with strict check\n"; if (in_array(1.13, $a, TRUE)) echo "1.13 found with strict check\n"; ?> ]]> </programlisting> <para> ½«ÏÔʾ£º <screen role="php"> <![CDATA[ 1.13 found with strict check ]]> </screen> </para> </example> </para> <para> <example> <title><function>in_array</function> ÖÐÓÃÊý×é×÷Ϊ needle</title> <programlisting role="php"> <![CDATA[ <?php $a = array(array('p', 'h'), array('p', 'r'), 'o'); if (in_array(array ('p', 'h'), $a)) echo "'ph' was found\n"; if (in_array(array ('f', 'i'), $a)) echo "'fi' was found\n"; if (in_array('o', $a)) echo "'o' was found\n"; ?> // This will output: 'ph' was found 'o' was found ]]> </programlisting> </example> </para> <para> ²Î¼û <function>array_search</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/key.xml +++ phpdoc-zh/reference/array/functions/key.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.key"> <refnamediv> <refname>key</refname> <refpurpose>´Ó½áºÏÊý×éÖÐÈ¡µÃ¼üÃû</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>mixed</type><methodname>key</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> </methodsynopsis> <para> <function>key</function> ·µ»ØÊý×éÖе±Ç°µ¥ÔªµÄ¼üÃû¡£ </para> <para> ²Î¼û <function>current</function> ºÍ <function>next</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/krsort.xml +++ phpdoc-zh/reference/array/functions/krsort.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.krsort"> <refnamediv> <refname>krsort</refname> <refpurpose>¶ÔÊý×é°´ÕÕ¼üÃûÄæÏòÅÅÐò</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>int</type><methodname>krsort</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> </methodsynopsis> <para> ¶ÔÊý×é°´ÕÕ¼üÃûÄæÏòÅÅÐò£¬±£Áô¼üÃûµ½Êý¾ÝµÄ¹ØÁª¡£Ö÷ÒªÓÃÓÚ¹ØÁªÊý×é¡£ <example> <title><function>krsort</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); krsort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } ]]> </programlisting> </example> </para> <para> ±¾Àý½«ÏÔʾ£º </para> <para> <screen> <![CDATA[ d = lemon c = apple b = banana a = orange ]]> </screen> </para> <para> ¿ÉÒÔÓÿÉÑ¡²ÎÊý <parameter>sort_flags</parameter> ¸Ä±äÅÅÐòµÄÐÐΪ£¬ÏêÇé¼û <function>sort</function>¡£ </para> <simpara> ²Î¼û <function>asort</function>£¬<function>arsort</function>£¬<function>ksort</function>£¬<function>sort</function>£¬<function>natsort</function> ºÍ <function>rsort</function>¡£ </simpara> </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/ksort.xml +++ phpdoc-zh/reference/array/functions/ksort.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.ksort"> <refnamediv> <refname>ksort</refname> <refpurpose>¶ÔÊý×é°´ÕÕ¼üÃûÅÅÐò</refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>int</type><methodname>ksort</methodname> <methodparam><type>array</type><parameter>array</parameter></methodparam> <methodparam choice="opt"><type>int</type><parameter>sort_flags</parameter></methodparam> </methodsynopsis> <para> ¶ÔÊý×é°´ÕÕ¼üÃûÅÅÐò£¬±£Áô¼üÃûµ½Êý¾ÝµÄ¹ØÁª¡£±¾º¯ÊýÖ÷ÒªÓÃÓÚ¹ØÁªÊý×é¡£ <example> <title><function>ksort</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ $fruits = array ("d"=>"lemon", "a"=>"orange", "b"=>"banana", "c"=>"apple"); ksort ($fruits); reset ($fruits); while (list ($key, $val) = each ($fruits)) { echo "$key = $val\n"; } ]]> </programlisting> </example> </para> <para> ±¾Àý½«ÏÔʾ£º </para> <para> <screen> <![CDATA[ a = orange b = banana c = apple d = lemon ]]> </screen> </para> <para> ¿ÉÒÔÓÿÉÑ¡²ÎÊý <parameter>sort_flags</parameter> ¸Ä±äÅÅÐòµÄÐÐΪ£¬ÏêÇé¼û <function>sort</function>¡£ </para> <simpara> ²Î¼û <function>asort</function>£¬<function>arsort</function>£¬<function>krsort</function>£¬<function>uksort</function>£¬<function>sort</function>£¬<function>natsort</function> ºÍ <function>rsort</function>¡£ </simpara> <note> <para> µÚ¶þ¸ö²ÎÊýÊÇ PHP 4 мӵġ£ </para> </note> </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/list.xml +++ phpdoc-zh/reference/array/functions/list.xml <?xml version="1.0" encoding="gb2312"?> <!-- $Revision: 1.1 $ --> <!-- $Author: dallas $ --> <!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> <refentry id="function.list"> <refnamediv> <refname>list</refname> <refpurpose> °ÑÊý×éÖеÄÖµ¸³¸øÒ»Ð©±äÁ¿ </refpurpose> </refnamediv> <refsect1> <title>˵Ã÷</title> <methodsynopsis> <type>void</type><methodname>list</methodname> <methodparam rep="repeat"><type>mixed</type><parameter>...</parameter></methodparam> </methodsynopsis> <para> Ïñ <function>array</function> Ò»Ñù£¬Õâ²»ÊÇÕæÕýµÄº¯Êý£¬¶øÊÇÓïÑԽṹ¡£<function>list</function> ÓÃÓÃÒ»²½²Ù×÷¸øÒ»×é±äÁ¿½øÐи³Öµ¡£ </para> <note> <para> <function>list</function> ½öÄÜÓÃÓÚÊý×ÖË÷ÒýµÄÊý×é²¢¼Ù¶¨Êý×ÖË÷Òý´Ó 0 ¿ªÊ¼¡£ </para> </note> <para> <example> <title><function>list</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ <?php $info = array('coffee', 'brown', 'caffeine'); // Listing all the variables list($drink, $color, $power) = $info; print "$drink is $color and $power makes it special.\n"; // Listing some of them list($drink, , $power) = $info; print "$drink has $power.\n"; // Or let's skip to only the third one list( , , $power) = $info; print "I need $power!\n"; ?> ]]> </programlisting> </example> </para> <para> <example> <title>ʹÓà <function>list</function> µÄÀý×Ó</title> <programlisting role="php"> <![CDATA[ <table> <tr> <th>Employee name</th> <th>Salary</th> </tr> <?php $result = mysql_query ("SELECT id, name, salary FROM employees",$conn); while (list ($id, $name, $salary) = mysql_fetch_row ($result)) { print (" <tr>\n". " <td><a href=\"info.php?id=$id\">$name</a></td>\n". " <td>$salary</td>\n". " </tr>\n"); } ?> </table> ]]> </programlisting> </example> </para> <warning> <para> <function>list</function> ´Ó×îÓÒ±ßÒ»¸ö²ÎÊý¿ªÊ¼¸³Öµ¡£Èç¹ûÄãÓõ¥´¿µÄ±äÁ¿£¬²»Óõ£ÐÄÕâÒ»µã¡£µ«ÊÇÈç¹ûÄãÓÃÁ˾ßÓÐË÷ÒýµÄÊý×飬ͨ³£ÄãÆÚÍûµÃµ½µÄ½á¹ûºÍÔÚ <function>list</function> ÖÐдµÄÒ»ÑùÊÇ´Ó×óµ½Óҵ쬵«Êµ¼ÊÉϲ»ÊÇ¡£ÊÇÒÔÏ෴˳Ðò¸³ÖµµÄ¡£ </para> </warning> <para> <example> <title>ÔÚ <function>list</function> ÖÐʹÓÃÊý×éË÷Òý</title> <programlisting role="php"> <![CDATA[ <?php $info = array('coffee', 'brown', 'caffeine'); list($a[0], $a[1], $a[2]) = $info; var_dump($a); ]]> </programlisting> </example> ²úÉúÈçÏÂÊä³ö£¨×¢ÒⵥԪ˳ÐòºÍ <function>list</function> Óï·¨ÖÐËùдµÄ˳ÐòµÄ±È½Ï£©£º <screen> array(3) { [2]=> string(8) "caffeine" [1]=> string(5) "brown" [0]=> string(6) "coffee" } </screen> </para> <para> ²Î¼û <function>each</function>£¬<function>array</function> ºÍ <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 -->
« previous php.doc.zh (#568) next »