- rtrim: documentation ( source)
- var_export: documentation ( source)
- ini_get: documentation ( source)
- number_format: documentation ( source)
<?php
echo var_export(20 / 3 * 1e6, true) . "\n";
echo var_export(6.66, true) . "\n";
echo var_export(6.0, true) . "\n";
function format($f) {
return rtrim(rtrim(number_format($f, ini_get('precision'), '.', ''), '0'), '.');
}
echo format(20/3) . "\n";
echo format(200000000 / 3) . "\n";
echo 200000000 / 3 . "\n";
echo format(6.66) . "\n";
echo format(6.0) . "\n";
echo format(60.0) . "\n";