3v4l.org

run code in 500+ PHP versions simultaneously
<?php $item = []; $item['order_price'] = '$25.80'; $fmt = new NumberFormatter('en', NumberFormatter::CURRENCY); $decimal = $fmt->parseCurrency($item['order_price'], $cur); var_dump($decimal, $cur); $currency = $fmt->formatCurrency($decimal, $cur); var_dump($currency);
Output for 8.5.1 - 8.5.7
Fatal error: Uncaught Error: Class "NumberFormatter" not found in /in/XmE3h:6 Stack trace: #0 {main} thrown in /in/XmE3h on line 6
Process exited with code 255.
Output for 7.4.0 - 7.4.32, 8.0.1 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0
float(25.8) string(3) "USD" string(6) "$25.80"
Output for 7.4.33
Fatal error: Uncaught Error: Class 'NumberFormatter' not found in /in/XmE3h:6 Stack trace: #0 {main} thrown in /in/XmE3h on line 6
Process exited with code 255.

preferences:
69.91 ms | 1253 KiB | 4 Q