3v4l.org

run code in 500+ PHP versions simultaneously
<?php function convert_digits_to_en($entry){ $fmt = numfmt_create('fa', NumberFormatter::DECIMAL); return numfmt_parse($fmt, $entry); } echo convert_digits_to_en("test۰۹۱۲");
Output for 5.6.38 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.34, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.34, 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0
Output for 7.3.32 - 7.3.33, 7.4.33, 8.0.13, 8.5.1 - 8.5.11
Fatal error: Uncaught Error: Call to undefined function numfmt_create() in /in/H5EMY:4 Stack trace: #0 /in/H5EMY(8): convert_digits_to_en('test\xDB\xB0\xDB\xB9\xDB\xB1\xDB\xB2') #1 {main} thrown in /in/H5EMY on line 4
Process exited with code 255.

preferences:
36.41 ms | 1160 KiB | 19 Q