3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo 'Comma Formatted: ' . nyx_number_format('1.233.332,34', 'comma') . ' - '; echo 'Dot Formatted: ' . nyx_number_format('1,233,332.34', 'dot'); function nyx_number_format($number, $separator = 'dot') { // Default setting $thousand_separator = ','; $decimal_separator = '.'; if ($separator == 'comma') { $thousand_separator = '.'; $decimal_separator = ','; } // Remove the thousand separator $number = str_replace($thousand_separator, '', $number); // Make sure the Decimal separator is correct $number = str_replace($decimal_separator, '.', $number); if ($separator == 'comma') { return number_format($number, 2, ',', '.'); } return number_format($number, 2, '.', ','); }
Output for git.master, git.master_jit, rfc.property-hooks
Comma Formatted: 1.233.332,34 - Dot Formatted: 1,233,332.34

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:
35.41 ms | 401 KiB | 8 Q