3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $locales = array( 'en_GB', 'en-GB', 'en', 'es_ES@EURO', 'es_ES@UTF-8', ); foreach($locales as $locale) { var_dump(Locale::canonicalize($locale)); }
Output for 5.4.0 - 7.1.0
string(5) "en_GB" string(5) "en_GB" string(2) "en" string(18) "es_ES@currency=EUR" string(11) "es_ES_UTF_8"
Output for 5.0.0 - 5.3.29
Fatal error: Class 'Locale' not found in /in/rdddu on line 12
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Undefined class name 'locale' in /in/rdddu on line 12
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Undefined class name 'locale' in /in/rdddu on line 12