php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30611 microtime documentation small bug
Submitted: 2004-10-29 11:22 UTC Modified: 2004-10-29 11:32 UTC
From: tux at centrum dot cz Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: tux at centrum dot cz
New email:
PHP Version: OS:

 

 [2004-10-29 11:22 UTC] tux at centrum dot cz
Description:
------------
In documentation for microtime() at php.net, there is an example:

<?php
/**
 * Simple function to replicate PHP 5 behaviour
 */
function microtime_float()
{
   list($usec, $sec) = explode(" ", microtime());
   return ((float)$usec + (float)$sec);
}
..

shouldn't be the last line in microtime_float() this?

   return ((float)$usec/(float)1000000 + (float)$sec);

Summing seconds and microseconds without conversion won;t work ...


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-29 11:35 UTC] derick@php.net
Docs are correct, and your example is wrong.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sat Jul 12 02:01:35 2025 UTC