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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
5 + 3 = ?
Subscribe to this entry?

 
 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2024 The PHP Group
All rights reserved.
Last updated: Fri May 17 18:01:33 2024 UTC