svn: /phpdoc/en/trunk/reference/datetime/functions/ microtime.xml

From: Date: Mon, 12 Nov 2012 22:34:55 +0000
Subject: svn: /phpdoc/en/trunk/reference/datetime/functions/ microtime.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-10704@lists.php.net to get a copy of this message
salathe Mon, 12 Nov 2012 22:34:55 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=328336 Log: Added script execution timing example which utilizes REQUEST_TIME_FLOAT (microtime as float) added in PHP 5.4 -- Provided by Dejan Marjanovic (dejan.marjanovic@gmail.com) Changed paths: U phpdoc/en/trunk/reference/datetime/functions/microtime.xml Modified: phpdoc/en/trunk/reference/datetime/functions/microtime.xml =================================================================== --- phpdoc/en/trunk/reference/datetime/functions/microtime.xml 2012-11-12 22:34:43 UTC (rev 328335) +++ phpdoc/en/trunk/reference/datetime/functions/microtime.xml 2012-11-12 22:34:55 UTC (rev 328336) @@ -126,6 +126,23 @@ ]]> </programlisting> </example> + <example> + <title><function>microtime</function> and <literal>REQUEST_TIME_FLOAT</literal> (as of PHP 5.4.0)</title> + <programlisting role="php"> +<![CDATA[ +<?php +// Randomize sleeping time +usleep(mt_rand(100, 10000)); + +// As of PHP 5.4.0, REQUEST_TIME_FLOAT is available in the $_SERVER superglobal array. +// It contains the timestamp of the start of the request with microsecond precision. +$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"]; + +echo "Did nothing in $time seconds\n"; +?> +]]> + </programlisting> + </example> </para> </refsect1>

« previous php.doc.cvs (#10704) next »