3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fNumString(string $numberString, string $decimalPoint = '.', string $thousandsSeparator = ','): string { [$integerPart, $decimalPart] = array_pad(explode('.', $numberString, 2), 2, null); $integerPart = strrev(preg_replace('/\d{3}(?=\d)/', '\0' . $thousandsSeparator, strrev($integerPart))); return $integerPart . ($decimalPart ? $decimalPoint . $decimalPart : ''); } echo fNumString('1000.382'), PHP_EOL; echo fNumString('99.01'), PHP_EOL; echo fNumString('1900000'), PHP_EOL; echo fNumString('19000000000000000000123.12399999999198');
Output for git.master, git.master_jit, rfc.property-hooks
1,000.382 99.01 1,900,000 19,000,000,000,000,000,000,123.12399999999198

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
153.02 ms | 405 KiB | 5 Q