$a = microtime(true);
echo ‘sdfsdfsdf‘;
$b = microtime(true);
$c = $b-$a;
echo "<br/>";
echo $c;//输出为5.0067901611328E-6
echo "<br/>";
/**
* @param $num 科学计数法字符串 如 2.1E-5
*@param int $double 小数点保留位数 默认5位
* @return string 输出为字符串型数字
*/
function sctonum($num, $double = 5){
if(false !== stripos($num, "e"))
{
$a = explode("e",strtolower($num));
return bcmul($a[0], bcpow(10, $a[1], $double), $double);
}
}
echo sctonum($c, 10); //输出0.0000050067
时间: 2024-11-15 12:14:28