i have php script show time like: 9.08374786377e-5 , need plain floating value time : 0.00009083747..... thats why print float that:
<?php function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } $time_start = microtime_float(); $time_end = microtime_float(); $time = $time_end - $time_start; printf('%.16f', $time); ?>
its show result nicely, need set printing value in new variable. how can ? need set printing value in new variable $var;
$var = printf('%.16f', $time);
// know not working, how set ?
you need use sprintf command data variable... printf outputs results whereas sprintf returns results
$var = sprintf('%.16f', $time);
Comments
Post a Comment