cvs: phpdoc-zh /reference/math/functions base-convert.xml ceil.xml floor.xml fmod.xml hexdec.xml is-finite.xml is-infinite.xml is-nan.xml max.xml
min.xml mt-rand.xml mt-srand.xml pi.xml rand.xml round.xml sin.xml sqrt.xml srand.xml

From: Date: Tue, 19 Aug 2003 01:55:09 +0000
Subject: cvs: phpdoc-zh /reference/math/functions base-convert.xml ceil.xml floor.xml fmod.xml hexdec.xml is-finite.xml is-infinite.xml is-nan.xml max.xml
min.xml mt-rand.xml mt-srand.xml pi.xml rand.xml round.xml sin.xml sqrt.xml srand.xml
Groups: php.doc.zh 
Request: Send a blank email to doc-zh+get-1646@lists.php.net to get a copy of this message
dallas Mon Aug 18 21:55:09 2003 EDT Modified files: /phpdoc-zh/reference/math/functions base-convert.xml ceil.xml floor.xml fmod.xml hexdec.xml is-finite.xml is-infinite.xml is-nan.xml max.xml min.xml mt-rand.xml mt-srand.xml pi.xml rand.xml round.xml sin.xml sqrt.xml srand.xml Log: Updated.

Index: phpdoc-zh/reference/math/functions/base-convert.xml diff -u phpdoc-zh/reference/math/functions/base-convert.xml:1.1 phpdoc-zh/reference/math/functions/base-convert.xml:1.2 --- phpdoc-zh/reference/math/functions/base-convert.xml:1.1 Sun Mar 9 05:18:12 2003 +++ phpdoc-zh/reference/math/functions/base-convert.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> <refentry id="function.base-convert"> <refnamediv> <refname>base_convert</refname> @@ -9,12 +9,12 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>string</type><methodname>base_convert</methodname> - <methodparam><type>string</type><parameter>number</parameter></methodparam> - <methodparam><type>int</type><parameter>frombase</parameter></methodparam> - <methodparam><type>int</type><parameter>tobase</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>string</type><methodname>base_convert</methodname> + <methodparam><type>string</type><parameter>number</parameter></methodparam> + <methodparam><type>int</type><parameter>frombase</parameter></methodparam> + <methodparam><type>int</type><parameter>tobase</parameter></methodparam> + </methodsynopsis> <para> ·µ»ØÒ»×Ö·û´®£¬°üº¬ <parameter>number</parameter> ÒÔ <parameter>tobase</parameter> ½øÖƵıíʾ¡£<parameter>number</parameter> @@ -27,9 +27,20 @@ <title><function>base_convert</function></title> <programlisting role="php"> <![CDATA[ -$binary = base_convert ($hexadecimal, 16, 2); +<?php +$hexadecimal = 'A37334'; +echo base_convert($hexadecimal, 16, 2); +?> ]]> -</programlisting> + </programlisting> + <para> + Êä³öΪ£º + </para> + <screen> +<![CDATA[ +101000110111001100110100 +]]> + </screen> </example> </para> </refsect1> Index: phpdoc-zh/reference/math/functions/ceil.xml diff -u phpdoc-zh/reference/math/functions/ceil.xml:1.2 phpdoc-zh/reference/math/functions/ceil.xml:1.3 --- phpdoc-zh/reference/math/functions/ceil.xml:1.2 Tue Mar 11 05:04:00 2003 +++ phpdoc-zh/reference/math/functions/ceil.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.ceil"> <refnamediv> <refname>ceil</refname> @@ -9,25 +9,29 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>float</type><methodname>ceil</methodname> - <methodparam><type>float</type><parameter>value</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>float</type><methodname>ceil</methodname> + <methodparam><type>float</type><parameter>value</parameter></methodparam> + </methodsynopsis> <simpara> ·µ»Ø²»Ð¡ÓÚ <parameter>value</parameter> µÄÏÂÒ»¸öÕûÊý£¬<parameter>value</parameter> Èç¹ûÓÐСÊý²¿·ÖÔò½øÒ»Î»¡£<function>ceil</function> ·µ»ØµÄÀàÐÍÈÔÈ»ÊÇ <type>float</type>£¬ÒòΪ <type>float</type> ÖµµÄ·¶Î§Í¨³£±È <type>integer</type> Òª´ó¡£ </simpara> - <example> - <title><function>ceil</function> Àý×Ó</title> - <programlisting role="php"> + <para> + <example> + <title><function>ceil</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ +<?php echo ceil(4.3); // 5 echo ceil(9.999); // 10 +?> ]]> - </programlisting> - </example> + </programlisting> + </example> + </para> <simpara> ²Î¼û <function>floor</function> ºÍ <function>round</function>¡£ Index: phpdoc-zh/reference/math/functions/floor.xml diff -u phpdoc-zh/reference/math/functions/floor.xml:1.1 phpdoc-zh/reference/math/functions/floor.xml:1.2 --- phpdoc-zh/reference/math/functions/floor.xml:1.1 Tue Mar 11 05:04:05 2003 +++ phpdoc-zh/reference/math/functions/floor.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.floor"> <refnamediv> <refname>floor</refname> @@ -9,10 +9,10 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>float</type><methodname>floor</methodname> - <methodparam><type>float</type><parameter>value</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>float</type><methodname>floor</methodname> + <methodparam><type>float</type><parameter>value</parameter></methodparam> + </methodsynopsis> <simpara> ·µ»Ø²»´óÓÚ <parameter>value</parameter> µÄÏÂÒ»¸öÕûÊý£¬½« @@ -20,15 +20,19 @@ µÄСÊý²¿·ÖÉáȥȡÕû¡£<function>floor</function> ·µ»ØµÄÀàÐÍÈÔÈ»ÊÇ <type>float</type>£¬ÒòΪ <type>float</type> ÖµµÄ·¶Î§Í¨³£±È <type>integer</type> Òª´ó¡£ </simpara> - <example> - <title><function>floor</function> Àý×Ó</title> - <programlisting role="php"> + <para> + <example> + <title><function>floor</function> Àý×Ó</title> + <programlisting role="php"> <![CDATA[ +<?php echo floor(4.3); // 4 echo floor(9.999); // 9 +?> ]]> - </programlisting> - </example> + </programlisting> + </example> + </para> <simpara> ²Î¼û <function>ceil</function> ºÍ <function>round</function>¡£ Index: phpdoc-zh/reference/math/functions/fmod.xml diff -u phpdoc-zh/reference/math/functions/fmod.xml:1.1 phpdoc-zh/reference/math/functions/fmod.xml:1.2 --- phpdoc-zh/reference/math/functions/fmod.xml:1.1 Tue Mar 11 05:04:05 2003 +++ phpdoc-zh/reference/math/functions/fmod.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.fmod"> <refnamediv> <refname>fmod</refname> @@ -9,11 +9,11 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>float</type><methodname>fmod</methodname> - <methodparam><type>float</type><parameter>x</parameter></methodparam> - <methodparam><type>float</type><parameter>y</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>float</type><methodname>fmod</methodname> + <methodparam><type>float</type><parameter>x</parameter></methodparam> + <methodparam><type>float</type><parameter>y</parameter></methodparam> + </methodsynopsis> <para> ·µ»Ø±»³ýÊý£¨<parameter>x</parameter>£©³ýÒÔ³ýÊý£¨<parameter>y</parameter>£©ËùµÃµÄ¸¡µãÊýÓàÊý¡£ÓàÊý£¨<varname>r</varname>£©µÄ¶¨ÒåÊÇ£ºx = i * y + r£¬ÆäÖÐ <varname>i</varname> ÊÇÕûÊý¡£Èç¹û <parameter>y</parameter> @@ -21,17 +21,21 @@ <parameter>x</parameter> µÄ·ûºÅÏàͬ²¢ÇÒÆäÊýÁ¿ÖµÐ¡ÓÚ <parameter>y</parameter>¡£ </para> - <example> - <title>ʹÓà <function>fmod</function></title> - <programlisting role="php"> + <para> + <example> + <title>ʹÓà <function>fmod</function></title> + <programlisting role="php"> <![CDATA[ +<?php $x = 5.7; $y = 1.3; $r = fmod($x, $y); // $r equals 0.5, because 4 * 1.3 + 0.5 = 5.7 +?> ]]> - </programlisting> - </example> + </programlisting> + </example> + </para> </refsect1> </refentry> Index: phpdoc-zh/reference/math/functions/hexdec.xml diff -u phpdoc-zh/reference/math/functions/hexdec.xml:1.1 phpdoc-zh/reference/math/functions/hexdec.xml:1.2 --- phpdoc-zh/reference/math/functions/hexdec.xml:1.1 Tue Mar 11 05:04:05 2003 +++ phpdoc-zh/reference/math/functions/hexdec.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.hexdec"> <refnamediv> <refname>hexdec</refname> @@ -9,10 +9,10 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>int</type><methodname>hexdec</methodname> - <methodparam><type>string</type><parameter>hex_string</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>int</type><methodname>hexdec</methodname> + <methodparam><type>string</type><parameter>hex_string</parameter></methodparam> + </methodsynopsis> <para> ·µ»ØÓë <parameter>hex_string</parameter> ²ÎÊýËù±íʾµÄÊ®Áù½øÖÆÊýµÈÖµµÄµÄÊ®½øÖÆÊý¡£<function>hexdec</function> @@ -26,13 +26,15 @@ <title><function>hexdec</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ +<?php var_dump(hexdec("See")); var_dump(hexdec("ee")); -// both prints "int(238)" +// both print "int(238)" var_dump(hexdec("that")); var_dump(hexdec("a0")); -// both prints int(160) +// both print int(160) +?> ]]> </programlisting> </example> Index: phpdoc-zh/reference/math/functions/is-finite.xml diff -u phpdoc-zh/reference/math/functions/is-finite.xml:1.1 phpdoc-zh/reference/math/functions/is-finite.xml:1.2 --- phpdoc-zh/reference/math/functions/is-finite.xml:1.1 Tue Mar 11 05:42:11 2003 +++ phpdoc-zh/reference/math/functions/is-finite.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> <refentry id='function.is-finite'> <refnamediv> <refname>is_finite</refname> @@ -9,13 +9,16 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>bool</type><methodname>is_finite</methodname> - <methodparam><type>float</type><parameter>val</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>bool</type><methodname>is_finite</methodname> + <methodparam><type>float</type><parameter>val</parameter></methodparam> + </methodsynopsis> <para> Èç¹û <parameter>val</parameter> ÊDZ¾»úƽ̨ÉÏ PHP ¸¡µãÊýËùÔÊÐí·¶Î§ÖеÄÒ»¸öºÏ·¨µÄÓÐÏÞÖµ£¬Ôò·µ»Ø &true;¡£ + </para> + <para> + ²Î¼û <function>is_infinite</function> ºÍ <function>is_nan</function>¡£ </para> </refsect1> </refentry> Index: phpdoc-zh/reference/math/functions/is-infinite.xml diff -u phpdoc-zh/reference/math/functions/is-infinite.xml:1.1 phpdoc-zh/reference/math/functions/is-infinite.xml:1.2 --- phpdoc-zh/reference/math/functions/is-infinite.xml:1.1 Tue Mar 11 05:42:11 2003 +++ phpdoc-zh/reference/math/functions/is-infinite.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> <refentry id='function.is-infinite'> <refnamediv> <refname>is_infinite</refname> @@ -9,14 +9,17 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>bool</type><methodname>is_infinite</methodname> - <methodparam><type>float</type><parameter>val</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>bool</type><methodname>is_infinite</methodname> + <methodparam><type>float</type><parameter>val</parameter></methodparam> + </methodsynopsis> <para> Èç¹û <parameter>val</parameter> ΪÎÞÇî´ó£¨ÕýµÄ»ò¸ºµÄ£©£¬ÀýÈç <literal>log(0)</literal> µÄ½á¹û»òÕßÈκ㬳ö±¾Æ½Ì¨µÄ¸¡µãÊý·¶Î§µÄÖµ£¬Ôò·µ»Ø &true;¡£ + </para> + <para> + ²Î¼û <function>is_finite</function> ºÍ <function>is_nan</function>¡£ </para> </refsect1> </refentry> Index: phpdoc-zh/reference/math/functions/is-nan.xml diff -u phpdoc-zh/reference/math/functions/is-nan.xml:1.1 phpdoc-zh/reference/math/functions/is-nan.xml:1.2 --- phpdoc-zh/reference/math/functions/is-nan.xml:1.1 Tue Mar 11 05:42:11 2003 +++ phpdoc-zh/reference/math/functions/is-nan.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.2 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> <refentry id='function.is-nan'> <refnamediv> <refname>is_nan</refname> @@ -9,13 +9,16 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>bool</type><methodname>is_nan</methodname> - <methodparam><type>float</type><parameter>val</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>bool</type><methodname>is_nan</methodname> + <methodparam><type>float</type><parameter>val</parameter></methodparam> + </methodsynopsis> <para> Èç¹û <parameter>val</parameter> Ϊ¡°·ÇÊýÖµ¡±£¬ÀýÈç <literal>acos(1.01)</literal> µÄ½á¹û£¬Ôò·µ»Ø &true;¡£ + </para> + <para> + ²Î¼û <function>is_finite</function> ºÍ <function>is_infinite</function>¡£ </para> </refsect1> </refentry> Index: phpdoc-zh/reference/math/functions/max.xml diff -u phpdoc-zh/reference/math/functions/max.xml:1.1 phpdoc-zh/reference/math/functions/max.xml:1.2 --- phpdoc-zh/reference/math/functions/max.xml:1.1 Tue Mar 11 05:42:11 2003 +++ phpdoc-zh/reference/math/functions/max.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.max"> <refnamediv> <refname>max</refname> @@ -10,24 +10,57 @@ <refsect1> <title>˵Ã÷</title> <methodsynopsis> - <type>number</type><methodname>max</methodname> - <methodparam><type>mixed</type><parameter>arg1</parameter></methodparam> - <methodparam><type>mixed</type><parameter>arg2</parameter></methodparam> - <methodparam><type>mixed</type><parameter>argn</parameter></methodparam> + <type>mixed</type><methodname>max</methodname> + <methodparam><type>number</type><parameter>arg1</parameter></methodparam> + <methodparam><type>number</type><parameter>arg2</parameter></methodparam> + <methodparam choice="opt"><type>number</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <methodsynopsis> + <type>mixed</type><methodname>max</methodname> + <methodparam><type>array</type><parameter>numbers</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> </methodsynopsis> <para> - <function>max</function> ·µ»Ø²ÎÊýÖÐÊýÖµ×î´óµÄ¡£ + <function>max</function> ·µ»Ø²ÎÊýÖÐÊýÖµ×î´óµÄÖµ¡£ </para> <para> - Èç¹ûµÚÒ»¸ö²ÎÊýΪÊý×飬<function>max</function> - ·µ»Ø¸ÃÊý×éÖÐ×î´óµÄÖµ¡£Èç¹ûµÚÒ»¸ö²ÎÊýÊÇÕûÊý¡¢×Ö·û´®»ò¸¡µãÊý£¬ÔòÖÁÉÙ»¹ÐèÒªÁ½¸ö²ÎÊý¶ø + Èç¹û½öÓÐÒ»¸ö²ÎÊýÇÒΪÊý×飬<function>max</function> + ·µ»Ø¸ÃÊý×éÖÐ×î´óµÄÖµ¡£Èç¹ûµÚÒ»¸ö²ÎÊýÊÇÕûÊý¡¢×Ö·û´®»ò¸¡µãÊý£¬ÔòÖÁÉÙÐèÒªÁ½¸ö²ÎÊý¶ø <function>max</function> »á·µ»ØÕâЩֵÖÐ×î´óµÄÒ»¸ö¡£¿ÉÒԱȽÏÎÞÏÞ¶à¸öÖµ¡£ </para> + <note> + <para> + PHP »á½«·ÇÊýÖµµÄ <type>string</type> µ±³É + <literal>0</literal>£¬µ«Èç¹ûÕâ¸öÕýÊÇ×î´óµÄÊýÖµÔòÈÔÈ»»á·µ»ØÒ»¸ö×Ö·û´®¡£Èç¹û¶à¸ö²ÎÊýµÄÖµ¶¼ÊÇ + <literal>0</literal>£¬<function>max</function> ½«·µ»ØµÚÒ»¸ö£¨×î×ó±ßµÄÖµ£©¡£ + </para> + </note> <para> - Èç¹ûÒ»¸ö»ò¶à¸öÖµÊǸ¡µãÊý£¬ËùÓеÄÖµ¶¼»á±»µ±³É¸¡µãÊý²¢·µ»ØÒ»¸ö¸¡µãÊý¡£Èç¹û²ÎÊýÖÐûÓи¡µãÊý£¬ËùÓеÄÖµ¶¼»á±»µ±³ÉÕûÊý²¢·µ»ØÒ»¸öÕûÊý¡£ + <example> + <title>ʹÓà <function>max</function> µÄÀý×Ó</title> + <programlisting role="php"> +<![CDATA[ +<?php +echo max(1, 3, 5, 6, 7); // 7 +echo max(array(2, 4, 5)); // 5 +echo max(0, 'hello'); // 0 +echo max('hello', 0); // hello +echo max(-1, 'hello'); // hello + +// ¶Ô¶à¸öÊý×飬max ´Ó×óÏòÓұȽϡ£ +// Òò´ËÔÚ±¾ÀýÖУº2 == 2£¬µ« 4 < 5 +$val = max(array(2, 4, 8), array(2, 5, 7)); // array(2, 5, 7) + +// Èç¹ûͬʱ¸ø³öÊý×éºÍ·ÇÊý×é×÷Ϊ²ÎÊý£¬Ôò×ÜÊǽ«Êý×éÊÓΪ +// ×î´óÖµ·µ»Ø +$val = max('string', array(2, 5, 7), 42); // array(2, 5, 7) +?> +]]> + </programlisting> + </example> </para> <para> - ²Î¼û <function>min</function>¡£ + ²Î¼û <function>min</function> ºÍ <function>count</function>¡£ </para> </refsect1> </refentry> Index: phpdoc-zh/reference/math/functions/min.xml diff -u phpdoc-zh/reference/math/functions/min.xml:1.2 phpdoc-zh/reference/math/functions/min.xml:1.3 --- phpdoc-zh/reference/math/functions/min.xml:1.2 Tue Mar 11 05:43:49 2003 +++ phpdoc-zh/reference/math/functions/min.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.min"> <refnamediv> <refname>min</refname> @@ -9,58 +9,58 @@ </refnamediv> <refsect1> <title>˵Ã÷</title> - <methodsynopsis> - <type>number</type><methodname>min</methodname> - <methodparam><type>number</type><parameter>arg1</parameter></methodparam> - <methodparam><type>number</type><parameter>arg2</parameter></methodparam> - <methodparam choice="opt"><parameter>...</parameter></methodparam> - </methodsynopsis> - <methodsynopsis> - <type>number</type><methodname>min</methodname> - <methodparam><type>array</type><parameter>numbers</parameter></methodparam> - </methodsynopsis> + <methodsynopsis> + <type>mixed</type><methodname>min</methodname> + <methodparam><type>number</type><parameter>arg1</parameter></methodparam> + <methodparam><type>number</type><parameter>arg2</parameter></methodparam> + <methodparam choice="opt"><type>number</type><parameter>...</parameter></methodparam> + </methodsynopsis> + <methodsynopsis> + <type>mixed</type><methodname>min</methodname> + <methodparam><type>array</type><parameter>numbers</parameter></methodparam> + <methodparam choice="opt"><type>array</type><parameter>...</parameter></methodparam> + </methodsynopsis> <para> <function>min</function> ·µ»Ø²ÎÊýÖÐÊýÖµ×îСµÄ¡£ </para> <para> - ÔÚµÚÒ»ÖÖ¸ñʽÖУ¬ÖÁÉÙ»¹ÐèÒªÁ½¸ö²ÎÊý¶ø <function>min</function> - »á·µ»ØÕâЩֵÖÐ×îСµÄÒ»¸ö¡£¿ÉÒԱȽÏÎÞÏÞ¶à¸öÖµ¡£Èç¹ûÆäÖÐÒ»¸ö±äÁ¿Ã»Óж¨Ò壬<function>min</function> »áʧ°Ü¡£ + Èç¹û½öÓÐÒ»¸ö²ÎÊýÇÒΪÊý×飬<function>min</function> + ·µ»Ø¸ÃÊý×éÖÐ×îСµÄÖµ¡£Èç¹ûµÚÒ»¸ö²ÎÊýÊÇÕûÊý¡¢×Ö·û´®»ò¸¡µãÊý£¬ÔòÖÁÉÙÐèÒªÁ½¸ö²ÎÊý¶ø + <function>min</function> »á·µ»ØÕâЩֵÖÐ×îСµÄÒ»¸ö¡£¿ÉÒԱȽÏÎÞÏÞ¶à¸öÖµ¡£ </para> - <para> - In the second variant, <function>min</function> - returns the lowest value in <parameter>numbers</parameter>. - </para> - <para> - Èç¹ûÒ»¸ö»ò¶à¸öÖµÊǸ¡µãÊý£¬ËùÓеÄÖµ¶¼»á±»µ±³É¸¡µãÊý²¢·µ»ØÒ»¸ö¸¡µãÊý¡£Èç¹û²ÎÊýÖÐûÓи¡µãÊý£¬ËùÓеÄÖµ¶¼»á±»µ±³ÉÕûÊý²¢·µ»ØÒ»¸öÕûÊý¡£Èç¹ûʧ°Ü£¬<function>min</function> - ·µ»Ø <type>NULL</type> ²¢²úÉúÒ»Ìõ <constant>E_WARNING</constant> ¼¶±ðµÄ´íÎó¡£ - </para> - <para> - <informalexample> - <programlisting> + <note> + <para> + PHP »á½«·ÇÊýÖµµÄ <type>string</type> µ±³É + <literal>0</literal>£¬µ«Èç¹ûÕâ¸öÕýÊÇ×îСµÄÊýÖµÔòÈÔÈ»»á·µ»ØÒ»¸ö×Ö·û´®¡£Èç¹û¶à¸ö²ÎÊýµÄÖµ¶¼ÊÇ + <literal>0</literal>£¬<function>min</function> ½«·µ»ØµÚÒ»¸ö£¨×î×ó±ßµÄÖµ£©¡£ + </para> + </note> + <para> + <example> + <title>ʹÓà <function>min</function> µÄÀý×Ó</title> + <programlisting role="php"> <![CDATA[ <?php -$a = 4; -$b = 9; -$c = 3; -$arr = array(99, 34, 11); - -// You may want to implement your own error checking in -// case of failure (a variable may not be set) -if (!$min_value = @min($a, $b, $c)) { - echo "Could not get min value, please try again."; -} else { - echo "min value is $min_value"; -} +echo min(2, 3, 1, 6, 7); // 1 +echo min(array(2, 4, 5)); // 2 +echo min(0, 'hello'); // 0 +echo min('hello', 0); // hello +echo min('hello', -1); // -1 -print min($arr); // 11 +// ¶Ô¶à¸öÊý×飬min ´Ó×óÏòÓұȽϡ£ +// Òò´ËÔÚ±¾ÀýÖУº2 == 2£¬µ« 4 < 5 +$val = min(array(2, 4, 8), array(2, 5, 1)); // array(2, 4, 8) +// Èç¹ûͬʱ¸ø³öÊý×éºÍ·ÇÊý×é×÷Ϊ²ÎÊý£¬Ôò²»¿ÉÄÜ·µ»ØÊý×飬ÒòΪ +// Êý×é±»ÊÓΪ×î´óµÄ +$val = min('string', array(2, 5, 7), 42); // string ?> ]]> </programlisting> - </informalexample> + </example> </para> <para> - ²Î¼û <function>max</function>¡£ + ²Î¼û <function>max</function> ºÍ <function>count</function>¡£ </para> </refsect1> </refentry> Index: phpdoc-zh/reference/math/functions/mt-rand.xml diff -u phpdoc-zh/reference/math/functions/mt-rand.xml:1.2 phpdoc-zh/reference/math/functions/mt-rand.xml:1.3 --- phpdoc-zh/reference/math/functions/mt-rand.xml:1.2 Wed Mar 12 06:06:07 2003 +++ phpdoc-zh/reference/math/functions/mt-rand.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> <refentry id="function.mt-rand"> <refnamediv> <refname>mt_rand</refname> @@ -31,10 +31,7 @@ Ö®¼äµÄÎ±Ëæ»úÊý¡£ÀýÈçÏëÒª 5 µ½ 15£¨°üÀ¨ 5 ºÍ 15£©Ö®¼äµÄËæ»úÊý£¬Óà <literal>mt_rand(5, 15)</literal>¡£ </simpara> - <simpara> - ÔÚ PHP ½ÏÔç°æ±¾ÖУ¬±ØÐëÔÚʹÓñ¾º¯Êý֮ǰµ÷Óà - <function>mt_srand</function> ²¥ÏÂËæ»úÊýÖÖ×Ó¡£×Ô 4.2.0 ²»ÔÙÐèÒªÕâÑù×öÁË¡£ - </simpara> + &note.randomseed; <note> <para> ÔÚ 3.0.7 ֮ǰµÄ°æ±¾ÖУ¬<parameter>max</parameter> Index: phpdoc-zh/reference/math/functions/mt-srand.xml diff -u phpdoc-zh/reference/math/functions/mt-srand.xml:1.2 phpdoc-zh/reference/math/functions/mt-srand.xml:1.3 --- phpdoc-zh/reference/math/functions/mt-srand.xml:1.2 Wed Mar 12 06:06:07 2003 +++ phpdoc-zh/reference/math/functions/mt-srand.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.2 $ --> +<!-- $Revision: 1.3 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.mt-srand"> <refnamediv> <refname>mt_srand</refname> @@ -19,6 +19,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php // seed with microseconds function make_seed() { list($usec, $sec) = explode(' ', microtime()); @@ -26,15 +27,12 @@ } mt_srand(make_seed()); $randval = mt_rand(); +?> ]]> </programlisting> </informalexample> </para> - <note> - <para> - ×Ô PHP 4.2.0 Æð²»ÔÙÐèÒªÔÚʹÓÃËæ»úÊý·¢ÉúÆ÷֮ǰ¸øÆä²¥ÖÖ¡£ - </para> - </note> + &note.randomseed; <simpara> ²Î¼û <function>mt_rand</function>£¬<function>mt_getrandmax</function> ºÍ <function>srand</function>¡£ Index: phpdoc-zh/reference/math/functions/pi.xml diff -u phpdoc-zh/reference/math/functions/pi.xml:1.5 phpdoc-zh/reference/math/functions/pi.xml:1.6 --- phpdoc-zh/reference/math/functions/pi.xml:1.5 Fri Jun 27 01:24:25 2003 +++ phpdoc-zh/reference/math/functions/pi.xml Mon Aug 18 21:55:08 2003 @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Author: yincheng $ --> -<!-- $Revision: 1.5 $ --> -<!-- EN-Revision: 1.3 Maintainer: yincheng Status: ready --> -<!-- splitted from ./en/functions/math.xml, last change in rev 1.2 --> +<!-- $Author: dallas $ --> +<!-- $Revision: 1.6 $ --> +<!-- EN-Revision: 1.4 Maintainer: yincheng Status: ready --> <refentry id="function.pi"> <refnamediv> <refname>pi</refname> @@ -22,7 +21,7 @@ </simpara> <para> <informalexample> - <programlisting> + <programlisting role="php"> <![CDATA[ <?php echo pi(); // 3.1415926535898 Index: phpdoc-zh/reference/math/functions/rand.xml diff -u phpdoc-zh/reference/math/functions/rand.xml:1.1 phpdoc-zh/reference/math/functions/rand.xml:1.2 --- phpdoc-zh/reference/math/functions/rand.xml:1.1 Wed Mar 12 06:06:07 2003 +++ phpdoc-zh/reference/math/functions/rand.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.6 Maintainer: dallas Status: ready --> <refentry id="function.rand"> <refnamediv> <refname>rand</refname> @@ -21,10 +21,13 @@ Ö®¼äµÄÎ±Ëæ»úÊý¡£ÀýÈçÏëÒª 5 µ½ 15£¨°üÀ¨ 5 ºÍ 15£©Ö®¼äµÄËæ»úÊý£¬Óà <literal>rand(5, 15)</literal>¡£ </simpara> - <simpara> - ÔÚ PHP ½ÏÔç°æ±¾ÖУ¬±ØÐëÔÚʹÓñ¾º¯Êý֮ǰµ÷Óà - <function>srand</function> ²¥ÏÂËæ»úÊýÖÖ×Ó¡£×Ô 4.2.0 ²»ÔÙÐèÒªÕâÑù×öÁË¡£ - </simpara> + <note> + <simpara> + ÔÚijЩƽ̨Ï£¨ÀýÈç Windows£©<constant>RAND_MAX</constant> + Ö»ÓÐ 32768¡£Èç¹ûÄãÐèÒªµÄ·¶Î§´óÓÚ 32768£¬¿¼ÂÇÓà <function>mt_rand</function> À´Ìæ´úÖ®¡£ + </simpara> + </note> + &note.randomseed; <note> <para> ÔÚ 3.0.7 ֮ǰµÄ°æ±¾ÖУ¬<parameter>max</parameter> Index: phpdoc-zh/reference/math/functions/round.xml diff -u phpdoc-zh/reference/math/functions/round.xml:1.1 phpdoc-zh/reference/math/functions/round.xml:1.2 --- phpdoc-zh/reference/math/functions/round.xml:1.1 Wed Mar 12 06:06:07 2003 +++ phpdoc-zh/reference/math/functions/round.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.round"> <refnamediv> <refname>round</refname> @@ -20,36 +20,52 @@ Ò²¿ÉÒÔÊǸºÊý»òÁ㣨ĬÈÏÖµ£©¡£ </para> <para> - <caution> - <simpara> - PHP ĬÈϲ»ÄÜÕýÈ·´¦ÀíÀàËÆ <literal>"12,300.2"</literal> - µÄ×Ö·û´®¡£¼û<link linkend="language.types.string.conversion">×Ö·û´®×ª»»ÎªÊýÖµ</link>¡£ - </simpara> - </caution> - </para> - <para> - <informalexample> + <example> + <title><function>round</function> Àý×Ó</title> <programlisting role="php"> <![CDATA[ +<?php echo round(3.4); // 3 echo round(3.5); // 4 echo round(3.6); // 4 echo round(3.6, 0); // 4 echo round(1.95583, 2); // 1.96 echo round(1241757, -3); // 1242000 +echo round(5.045, 2); // 5.04 +echo round(5.055, 2); // 5.06 +?> ]]> </programlisting> - </informalexample> + </example> + </para> + <para> + <caution> + <simpara> + ÔÚ¶ÔÕýºÃÒ»°ëµÄ·ÖÊý½øÐÐÉáÈëʱ <function>round</function> + ÔÚżÊý´ÎÉáÈ¥£¬ÔÚÆæÊý´Î½øÎ»¡£Èç¹ûÄãÏëÆÈʹËü¶Ô .5£¨»ò + .05£©×ÜÏòÒ»¸ö·½ÏòÉáÈ룬¼ÓÉÏ»ò¼õÈ¥Ò»¸öºÜСµÄÒò×Ó¡£¶ÔÒ»°ëÖµÉáÈ¥¶ÔÁíÒ»°ëÖµ½øÒ»µÄ±³ºóÔ­ÒòÊDZÜÃ⴫ͳµÄÒøÐÐÎÊÌ⣬¼´Èç¹û×ÜÊÇÉáÈ¥ÔòÒøÐдӹ˿ÍÄÇÀï¶àÄÃÁËÇ®£¬Èç¹û×ÜÊǽøÒ»ÔòÒøÐÐ×îÖÕ»áËðʧÁËÇ®¡£¶Ô´Ëƽ¾ùÉáÈëÔòÔÚͳ¼ÆÉÏ´ïµ½ÁËÆ½ºâ¡£ + </simpara> + </caution> + </para> + <para> + <note> + <simpara> + PHP ĬÈϲ»ÄÜÕýÈ·´¦ÀíÀàËÆ <literal>"12,300.2"</literal> + µÄ×Ö·û´®¡£¼û<link linkend="language.types.string.conversion">×Ö·û´®×ª»»ÎªÊýÖµ</link>¡£ + </simpara> + </note> + </para> + <para> + <note> + <simpara> + <parameter>precision</parameter> ²ÎÊý½öÔÚ + PHP 4 ÖпÉÓᣠ+ </simpara> + </note> </para> - <note> - <simpara> - <parameter>precision</parameter> ²ÎÊý½öÔÚ - PHP 4 ÖпÉÓᣠ- </simpara> - </note> <simpara> - ²Î¼û <function>ceil</function> ºÍ - <function>floor</function>¡£ + ²Î¼û <function>ceil</function>£¬<function>floor</function> + ºÍ <function>number_format</function>¡£ </simpara> </refsect1> </refentry> Index: phpdoc-zh/reference/math/functions/sin.xml diff -u phpdoc-zh/reference/math/functions/sin.xml:1.3 phpdoc-zh/reference/math/functions/sin.xml:1.4 --- phpdoc-zh/reference/math/functions/sin.xml:1.3 Sun Mar 9 04:37:35 2003 +++ phpdoc-zh/reference/math/functions/sin.xml Mon Aug 18 21:55:08 2003 @@ -1,8 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.3 $ --> +<!-- $Revision: 1.4 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.4 Maintainer: yincheng Status: ready --> -<!-- splitted from ./en/functions/math.xml, last change in rev 1.2 --> +<!-- EN-Revision: 1.5 Maintainer: yincheng Status: ready --> <refentry id="function.sin"> <refnamediv> <refname>sin</refname> @@ -19,7 +18,7 @@ </para> <para> <informalexample> - <programlisting> + <programlisting role="php"> <![CDATA[ <?php Index: phpdoc-zh/reference/math/functions/sqrt.xml diff -u phpdoc-zh/reference/math/functions/sqrt.xml:1.1 phpdoc-zh/reference/math/functions/sqrt.xml:1.2 --- phpdoc-zh/reference/math/functions/sqrt.xml:1.1 Wed Mar 12 06:06:07 2003 +++ phpdoc-zh/reference/math/functions/sqrt.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.3 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> <refentry id="function.sqrt"> <refnamediv> <refname>sqrt</refname> @@ -18,7 +18,7 @@ </para> <para> <informalexample> - <programlisting> + <programlisting role="php"> <![CDATA[ <?php // Precision depends on your precision directive Index: phpdoc-zh/reference/math/functions/srand.xml diff -u phpdoc-zh/reference/math/functions/srand.xml:1.1 phpdoc-zh/reference/math/functions/srand.xml:1.2 --- phpdoc-zh/reference/math/functions/srand.xml:1.1 Wed Mar 12 06:06:07 2003 +++ phpdoc-zh/reference/math/functions/srand.xml Mon Aug 18 21:55:08 2003 @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="gb2312"?> -<!-- $Revision: 1.1 $ --> +<!-- $Revision: 1.2 $ --> <!-- $Author: dallas $ --> -<!-- EN-Revision: 1.4 Maintainer: dallas Status: ready --> +<!-- EN-Revision: 1.5 Maintainer: dallas Status: ready --> <refentry id="function.srand"> <refnamediv> <refname>srand</refname> @@ -18,6 +18,7 @@ <informalexample> <programlisting role="php"> <![CDATA[ +<?php // seed with microseconds function make_seed() { list($usec, $sec) = explode(' ', microtime()); @@ -25,19 +26,16 @@ } srand(make_seed()); $randval = rand(); +?> ]]> </programlisting> </informalexample> </para> - <note> - <para> - ×Ô PHP 4.2.0 Æð²»ÔÙÐèÒªÔÚʹÓÃËæ»úÊý·¢ÉúÆ÷֮ǰ¸øÆä²¥ÖÖ¡£ - </para> - </note> + &note.randomseed; <simpara> ²Î¼û <function>rand</function>£¬<function>getrandmax</function> ºÍ <function>mt_srand</function>¡£ - </simpara> + </simpara> </refsect1> </refentry>
« previous php.doc.zh (#1646) next »