note 95542 added to function.number-format
| From: | gearondawtsbcglobaldawtnet at osu1 dot php dot net | Date: | Fri, 08 Jan 2010 05:37:51 +0000 |
| Subject: | note 95542 added to function.number-format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-164772@lists.php.net to get a copy of this message | ||
Found a VERY interesting usage for the number format system.
If the function microtime(TRUE) is called, i.e. return unix timestamp with the microseconds, you get
2 to 4 places after the decimal place for some weird reason. You'd think that you'd get
all of them.
You can recover all the decimal places two ways:
(1)
$reversedMantissaStringWithSpaceAsSeparator = microtime();
$mantissaAndRootInArray = explode( " ", $reversedMantissaStringWithSpaceAsSeparator );
$timestampWithMostOrAllDecimalPlaces = ( $mantissaAndRootInArray[1] . $mantissaAndRootInArray[0] );
echo $timestampWithMostOrAllDecimalPlaces;
or by using number_format, which I think returns a LOT MORE PLACES for some reason:
(2)
echo number_format( microtime(TRUE), 100)."<br>";
//note I get 22 places after the decimal, even MORE than the string version shows.
I have NOOOOOOO idea how accurate that is LOL! Or what's going on either. Just interesting.
----
Server IP: 69.147.83.197
Probable Submitter: 68.183.235.54
----
Manual Page -- http://www.php.net/manual/en/function.number-format.php
Edit -- https://master.php.net/note/edit/95542
Del: integrated -- https://master.php.net/note/delete/95542/integrated
Del: useless -- https://master.php.net/note/delete/95542/useless
Del: bad code -- https://master.php.net/note/delete/95542/bad+code
Del: spam -- https://master.php.net/note/delete/95542/spam
Del: non-english -- https://master.php.net/note/delete/95542/non-english
Del: in docs -- https://master.php.net/note/delete/95542/in+docs
Del: other reasons-- https://master.php.net/note/delete/95542
Reject -- https://master.php.net/note/reject/95542
Search -- https://master.php.net/manage/user-notes.php