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
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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

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: Tue Apr 30 00:01:30 2024 UTC