didou Thu Dec 18 12:43:32 2003 EDT
Modified files: /phpdoc/en/reference/array/functions range.xml reset.xml shuffle.xml uksort.xml /phpdoc/en/reference/calendar/functions gregoriantojd.xml jdtojewish.xml /phpdoc/en/reference/classobj reference.xml /phpdoc/en/reference/datetime/functions gmstrftime.xml microtime.xml mktime.xml strtotime.xml Log: some more CS
Index: phpdoc/en/reference/array/functions/range.xml diff -u phpdoc/en/reference/array/functions/range.xml:1.12 phpdoc/en/reference/array/functions/range.xml:1.13 --- phpdoc/en/reference/array/functions/range.xml:1.12 Mon Dec 15 11:47:04 2003 +++ phpdoc/en/reference/array/functions/range.xml Thu Dec 18 12:43:30 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.12 $ --> +<!-- $Revision: 1.13 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.range"> <refnamediv> @@ -39,7 +39,7 @@ <programlisting role="php"> <![CDATA[ <?php -// array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ,11, 12) +// array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12) foreach (range(0, 12) as $number) { echo $number; } Index: phpdoc/en/reference/array/functions/reset.xml diff -u phpdoc/en/reference/array/functions/reset.xml:1.8 phpdoc/en/reference/array/functions/reset.xml:1.9 --- phpdoc/en/reference/array/functions/reset.xml:1.8 Mon Dec 15 11:47:04 2003 +++ phpdoc/en/reference/array/functions/reset.xml Thu Dec 18 12:43:30 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.reset"> <refnamediv> @@ -29,16 +29,16 @@ $array = array('step one', 'step two', 'step three', 'step four'); // by default, the pointer is on the first element -echo current($array)."<br />\n"; // step "one" +echo current($array) . "<br />\n"; // step "one" // skip two steps next($array); next($array); -echo current($array)."<br />\n"; // "step three" +echo current($array) . "<br />\n"; // "step three" // reset pointer, start again on step one reset($array); -echo current($array)."<br />\n"; // "step one" +echo current($array) . "<br />\n"; // "step one" ?> ]]> Index: phpdoc/en/reference/array/functions/shuffle.xml diff -u phpdoc/en/reference/array/functions/shuffle.xml:1.7 phpdoc/en/reference/array/functions/shuffle.xml:1.8 --- phpdoc/en/reference/array/functions/shuffle.xml:1.7 Sun Aug 17 08:21:03 2003 +++ phpdoc/en/reference/array/functions/shuffle.xml Thu Dec 18 12:43:30 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.shuffle"> <refnamediv> @@ -21,8 +21,8 @@ <programlisting role="php"> <![CDATA[ <?php -$numbers = range(1,20); -srand((float)microtime()*1000000); +$numbers = range(1, 20); +srand((float)microtime() * 1000000); shuffle($numbers); while (list(, $number) = each($numbers)) { echo "$number "; Index: phpdoc/en/reference/array/functions/uksort.xml diff -u phpdoc/en/reference/array/functions/uksort.xml:1.8 phpdoc/en/reference/array/functions/uksort.xml:1.9 --- phpdoc/en/reference/array/functions/uksort.xml:1.8 Sun Aug 17 08:21:03 2003 +++ phpdoc/en/reference/array/functions/uksort.xml Thu Dec 18 12:43:30 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.8 $ --> +<!-- $Revision: 1.9 $ --> <!-- splitted from ./en/functions/array.xml, last change in rev 1.2 --> <refentry id="function.uksort"> <refnamediv> @@ -16,7 +16,7 @@ <methodparam><type>callback</type><parameter>cmp_function</parameter></methodparam> </methodsynopsis> <para> - This function will sort the keys of an array using a + <function>uksort</function> will sort the keys of an array using a user-supplied comparison function. If the array you wish to sort needs to be sorted by some non-trivial criteria, you should use this function. Index: phpdoc/en/reference/calendar/functions/gregoriantojd.xml diff -u phpdoc/en/reference/calendar/functions/gregoriantojd.xml:1.5 phpdoc/en/reference/calendar/functions/gregoriantojd.xml:1.6 --- phpdoc/en/reference/calendar/functions/gregoriantojd.xml:1.5 Mon Dec 15 11:47:46 2003 +++ phpdoc/en/reference/calendar/functions/gregoriantojd.xml Thu Dec 18 12:43:30 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/calendar.xml, last change in rev 1.4 --> <refentry id="function.gregoriantojd"> <refnamediv> @@ -31,7 +31,7 @@ <programlisting role="php"> <![CDATA[ <?php -$jd = GregorianToJD(10,11,1970); +$jd = GregorianToJD(10, 11, 1970); echo "$jd\n"; $gregorian = JDToGregorian($jd); echo "$gregorian\n"; Index: phpdoc/en/reference/calendar/functions/jdtojewish.xml diff -u phpdoc/en/reference/calendar/functions/jdtojewish.xml:1.7 phpdoc/en/reference/calendar/functions/jdtojewish.xml:1.8 --- phpdoc/en/reference/calendar/functions/jdtojewish.xml:1.7 Mon Dec 15 13:41:57 2003 +++ phpdoc/en/reference/calendar/functions/jdtojewish.xml Thu Dec 18 12:43:30 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.7 $ --> +<!-- $Revision: 1.8 $ --> <!-- splitted from ./en/functions/calendar.xml, last change in rev 1.4 --> <refentry id="function.jdtojewish"> <refnamediv> @@ -37,7 +37,7 @@ <programlisting role="php"> <![CDATA[ <?php -echo jdtojewish(gregoriantojd(10,8,2002), true, +echo jdtojewish(gregoriantojd(10, 8, 2002), true, CAL_JEWISH_ADD_GERESHAYIM + CAL_JEWISH_ADD_ALAFIM + CAL_JEWISH_ADD_ALAFIM_GERESH); ?> ]]> Index: phpdoc/en/reference/classobj/reference.xml diff -u phpdoc/en/reference/classobj/reference.xml:1.10 phpdoc/en/reference/classobj/reference.xml:1.11 --- phpdoc/en/reference/classobj/reference.xml:1.10 Mon Dec 15 11:47:47 2003 +++ phpdoc/en/reference/classobj/reference.xml Thu Dec 18 12:43:31 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.10 $ --> +<!-- $Revision: 1.11 $ --> <reference id="ref.classobj"> <title>Class/Object Functions</title> <titleabbrev>Classes/Objects</titleabbrev> @@ -150,7 +150,7 @@ // print out information about objects echo "veggie: CLASS " . get_class($veggie) . "\n"; echo "leafy: CLASS " . get_class($leafy); -echo ", PARENT " . get_parent_class($leafy)."\n"; +echo ", PARENT " . get_parent_class($leafy) . "\n"; // show veggie properties echo "\nveggie: Properties\n"; Index: phpdoc/en/reference/datetime/functions/gmstrftime.xml diff -u phpdoc/en/reference/datetime/functions/gmstrftime.xml:1.6 phpdoc/en/reference/datetime/functions/gmstrftime.xml:1.7 --- phpdoc/en/reference/datetime/functions/gmstrftime.xml:1.6 Mon Dec 15 11:48:45 2003 +++ phpdoc/en/reference/datetime/functions/gmstrftime.xml Thu Dec 18 12:43:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 --> <refentry id="function.gmstrftime"> <refnamediv> @@ -27,8 +27,8 @@ <![CDATA[ <?php setlocale(LC_TIME, 'en_US'); -echo strftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98))."\n"; -echo gmstrftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98))."\n"; +echo strftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n"; +echo gmstrftime("%b %d %Y %H:%M:%S", mktime(20, 0, 0, 12, 31, 98)) . "\n"; ?> ]]> </programlisting> Index: phpdoc/en/reference/datetime/functions/microtime.xml diff -u phpdoc/en/reference/datetime/functions/microtime.xml:1.4 phpdoc/en/reference/datetime/functions/microtime.xml:1.5 --- phpdoc/en/reference/datetime/functions/microtime.xml:1.4 Mon Dec 15 11:48:45 2003 +++ phpdoc/en/reference/datetime/functions/microtime.xml Thu Dec 18 12:43:32 2003 @@ -1,17 +1,18 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.4 $ --> +<!-- $Revision: 1.5 $ --> <!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 --> <refentry id="function.microtime"> <refnamediv> <refname>microtime</refname> <refpurpose> - Return current UNIX timestamp with microseconds</refpurpose> + Return current UNIX timestamp with microseconds + </refpurpose> </refnamediv> <refsect1> <title>Description</title> <methodsynopsis> - <type>string</type><methodname>microtime</methodname> - <void/> + <type>mixed</type><methodname>microtime</methodname> + <methodparam choice="opt"><type>bool</type><parameter>get_as_float</parameter></methodparam> </methodsynopsis> <para> Returns the string "msec sec" where sec is the current time @@ -20,6 +21,13 @@ function is only available on operating systems that support the gettimeofday() system call. </para> + <note> + <simpara> + The <parameter>get_as_float</parameter> parameter was added as of + <literal>PHP 5.0.0</literal>. It allows you to get the result of + <function>microtime</function> as a float. + </simpara> + </note> <para> Both portions of the string are returned in units of seconds. <example> @@ -27,21 +35,36 @@ <programlisting role="php"> <![CDATA[ <?php -function getmicrotime(){ - list($usec, $sec) = explode(" ",microtime()); + +function getmicrotime() { + list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = getmicrotime(); for ($i=0; $i < 1000; $i++){ - //do nothing, 1000 times + // do nothing, 1000 times } $time_end = getmicrotime(); $time = $time_end - $time_start; -echo "Did nothing in $time seconds"; +echo "Did nothing in $time seconds\n"; + +// with PHP 5 you can do the same this way: + +$time_start = microtime(true); + +for ($i=0; $i < 1000; $i++){ + // do nothing, 1000 times +} + +$time_end = microtime(true); +$time = $time_end - $time_start; + +echo "Did nothing in $time seconds\n"; + ?> ]]> </programlisting> Index: phpdoc/en/reference/datetime/functions/mktime.xml diff -u phpdoc/en/reference/datetime/functions/mktime.xml:1.6 phpdoc/en/reference/datetime/functions/mktime.xml:1.7 --- phpdoc/en/reference/datetime/functions/mktime.xml:1.6 Mon Dec 15 11:48:45 2003 +++ phpdoc/en/reference/datetime/functions/mktime.xml Thu Dec 18 12:43:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.6 $ --> +<!-- $Revision: 1.7 $ --> <!-- splitted from ./en/functions/datetime.xml, last change in rev 1.2 --> <refentry id="function.mktime"> <refnamediv> @@ -91,11 +91,11 @@ <programlisting role="php"> <![CDATA[ <?php -$lastday = mktime (0,0,0,3,0,2000); -echo strftime ("Last day in Feb 2000 is: %d", $lastday); +$lastday = mktime(0, 0, 0, 3, 0, 2000); +echo strftime("Last day in Feb 2000 is: %d", $lastday); -$lastday = mktime (0,0,0,4,-31,2000); -echo strftime ("Last day in Feb 2000 is: %d", $lastday); +$lastday = mktime(0, 0, 0, 4, -31, 2000); +echo strftime("Last day in Feb 2000 is: %d", $lastday); ?> ]]> </programlisting> Index: phpdoc/en/reference/datetime/functions/strtotime.xml diff -u phpdoc/en/reference/datetime/functions/strtotime.xml:1.5 phpdoc/en/reference/datetime/functions/strtotime.xml:1.6 --- phpdoc/en/reference/datetime/functions/strtotime.xml:1.5 Mon Dec 15 11:48:45 2003 +++ phpdoc/en/reference/datetime/functions/strtotime.xml Thu Dec 18 12:43:32 2003 @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="iso-8859-1"?> -<!-- $Revision: 1.5 $ --> +<!-- $Revision: 1.6 $ --> <!-- splitted from ./en/functions/datetime.xml, last change in rev 1.8 --> <refentry id="function.strtotime"> <refnamediv> @@ -57,7 +57,7 @@ if (($timestamp = strtotime($str)) === -1) { echo "The string ($str) is bogus"; } else { - echo "$str == ". date('l dS of F Y h:i:s A', $timestamp); + echo "$str == " . date('l dS of F Y h:i:s A', $timestamp); } ?> ]]>