3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $float = 0.00000038; echo "float: $float\n"; $str = (string)$float; echo "string: $str\n"; $n_dec = strlen(substr(strrchr($str, '.'), 1)); echo "$n_dec\n"; echo number_format($float, $n_dec), "\n"; echo number_format($float, 8), "\n";
Output for 5.2.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
float: 3.8E-7 string: 3.8E-7 4 0.0000 0.00000038
Output for 4.3.0 - 5.2.1
float: 3.8E-07 string: 3.8E-07 5 0.00000 0.00000038