これにはnumber_formatを使用できます。
<?php
$a=4;
$b=799999999999999;
$c=$a/$b;
$d = number_format($c, 15, ',', '');
echo $d;
?>
出力:0,000000000000005
をしかし、あなたが述べたように、あなたは小数点以下の桁数が固定されていないとして、よりダイナミックなソリューションを必要としています。だからここに私の提案された解決策があります。
ロングバージョン:
<?php
$a=4;
$b=799999999999999;
$c=$a/$b;
$e = 0; //this is our output variable
if((strpos($c, 'E'))){ //does the result contain an exponent ?
$d = explode("-",$c); //blow up the string and find what the decimal place is too
$e = number_format($c, $d[1], ',', ''); //format with the decimal place
}else{
$e = $c; //Number didn't contain an exponent, return the number
}
echo $e;
?>
、ここでは少しダウン短縮前のコードです:
<?php
$a=4;
$b=799999999999999;
$c=$a/$b;
$d = (strpos($c,'E')) ? number_format($c,explode("-",$c)[1],',','') : $c;
echo $d;
?>
私はあなたがそのアラートを得たかはわからないと(私は私の答えを削除して転載
[PHPが私の番号を.000021として指定したときに、科学的表記法で自分の番号を印刷しているのはなぜですか?](https://stackoverflow.com/questions/1471674/why-is-php-スクラムナンバーインプリントientific-notation-i-specified-it-00のとき) – ishegg