Aidan's PHP Repository

A repository for PHP functions and classes ...

function.microtime_float.php

Return microtime as a floating point number. Note: In PHP5, simply use microtime(true);

  • Author: Aidan Lister <aidan@php.net>
  • Version: 1.0.0
  • Link: http://aidanlister.com/repos/v/function.microtime_float.php
  • Views: 9345
  • Downloads: 1660

Source

Download this script <?php
/**
 * Return microtime as a floating point number.
 * Note: In PHP5, simply use microtime(true);
 *
 * @author      Aidan Lister <aidan@php.net>
 * @version     1.0.0
 * @link        http://aidanlister.com/repos/v/function.microtime_float.php
 */
function microtime_float ()
{ 
    list ($msec, $sec) = explode(' ', microtime()); 
    $microtime = (float)$msec + (float)$sec;
    return $microtime; 
}
 
?>

Comments

December 1st, 2005
Hi Aidan! At first, you did a great job. Your functions and classes are very usefully! I'm using this code to get microtime as floating point number: It is a bit faster than your way, about 20 - 25 %... Feel free to use it :-) Greeting Daniel Kressler