- preg_match: documentation ( source)
- print_r: documentation ( source)
- number_format: documentation ( source)
<?php
function float_strval($fltValue)
{
$strValue = (string)$fltValue;
if (preg_match("/E[\+\-]\d+$/", $strValue)) {
$strValue = number_format($fltValue, 16, '.', '');
}
$oldStrValue = number_format($fltValue, 16, '.', '');
return ['in!'=>$fltValue, 'out'=>$strValue, 'old'=>$oldStrValue];
}
print_r(float_strval(0.00000021));
print_r(float_strval(1209381092380198230.123));
print_r(float_strval(90.05));