3v4l.org

run code in 300+ PHP versions simultaneously
<?php printf("%6.2f",5.678); $a = new NumberFormatter("it-IT", NumberFormatter::DECIMAL); echo $a->format(12345.12345) . "<br>"; // outputs 12.345,12 $a->setAttribute(\NumberFormatter::MIN_FRACTION_DIGITS, 0); $a->setAttribute(\NumberFormatter::MAX_FRACTION_DIGITS, 100); // by default some locales got max 2 fraction digits, that is probably not what you want echo $a->format(12345.12345) . "<br>"; // outputs 12.345,12345

preferences:
51.36 ms | 402 KiB | 5 Q