3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $float = 0.0000000038; 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";
Output for 5.2.2 - 7.1.0
float: 3.8E-9 string: 3.8E-9 4 0.0000
Output for 4.3.0 - 5.2.1
float: 3.8E-09 string: 3.8E-09 5 0.00000