3v4l.org

run code in 300+ PHP versions simultaneously
<?php $locales = array( 'en_US', 'en_GB', 'es_AR', 'es_ES', 'fr_FR', 'de_DE', 'he_IL', ); $styles = array( NumberFormatter::DECIMAL, NumberFormatter::CURRENCY, ); foreach ($locales as $locale) { foreach ($styles as $style) { echo "$locale -- $style\n"; $formatter = new NumberFormatter($locale, $style); var_dump($formatter->format(100)); var_dump($formatter->format(100.00)); var_dump($formatter->format('100')); var_dump($formatter->format('not a number')); var_dump($formatter->format(true)); var_dump($formatter->format(false)); var_dump($formatter->format(array())); var_dump($formatter->format(array(5))); } } $formatter = new NumberFormatter('en_GB', NumberFormatter::PATTERN_DECIMAL); var_dump($formatter->format('123456'));
Output for git.master, git.master_jit, rfc.property-hooks
en_US -- 1 string(3) "100" string(3) "100" string(3) "100" Fatal error: Uncaught TypeError: NumberFormatter::format(): Argument #1 ($num) must be of type int|float, string given in /in/8Aoeb:25 Stack trace: #0 /in/8Aoeb(25): NumberFormatter->format('not a number') #1 {main} thrown in /in/8Aoeb on line 25
Process exited with code 255.

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:
58.53 ms | 403 KiB | 8 Q