- substr: documentation ( source)
- strrchr: documentation ( source)
- number_format: documentation ( source)
<?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";