note 95542 deleted from function.number-format by danbrown

From: Date: Fri, 08 Jan 2010 06:11:30 +0000
Subject: note 95542 deleted from function.number-format by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-164773@lists.php.net to get a copy of this message
Note Submitter: gearond awt sbc global dawt net ---- 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.

« previous php.notes (#164773) next »