3v4l.org

run code in 300+ PHP versions simultaneously
<?php $locales = [ 'en_US', 'es_ES', ]; $data = [ '1.234.567,891', '1,234,567.891', '1.23E987', 'Five', ]; foreach ($locales as $locale) { $fmt = new NumberFormatter($locale, NumberFormatter::DECIMAL); foreach ($data as $input) { $parsed = $fmt->parse($input); printf("In %s '%s' is %s (%s)\n", $locale, $input, $parsed ?: 'not a number', $fmt->getErrorMessage()); } }
Output for git.master, git.master_jit, rfc.property-hooks
In en_US '1.234.567,891' is 1.234 (U_ZERO_ERROR) In en_US '1,234,567.891' is 1234567.891 (U_ZERO_ERROR) In en_US '1.23E987' is INF (U_ZERO_ERROR) In en_US 'Five' is not a number (Number parsing failed: U_PARSE_ERROR) In es_ES '1.234.567,891' is 1234567.891 (U_ZERO_ERROR) In es_ES '1,234,567.891' is 1.234 (U_ZERO_ERROR) In es_ES '1.23E987' is not a number (Number parsing failed: U_PARSE_ERROR) In es_ES 'Five' is not a number (Number parsing failed: U_PARSE_ERROR)

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:
19.23 ms | 402 KiB | 8 Q