3v4l.org

run code in 300+ PHP versions simultaneously
<?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 [$fltValue, $strValue, $oldStrValue]; } print_r(float_strval(0.00000021)); print_r(float_strval(1209381092380198230.123)); print_r(float_strval(90.05));

preferences:
32.54 ms | 402 KiB | 5 Q