3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); error_reporting(-1); ini_set('display_errors', '1'); var_dump(Locale::acceptFromHttp('zh_Hant_TW')); echo "<br>\n"; var_dump(setlocale(LC_ALL, 'zh_Hant_TW')); echo "<br>\n"; var_dump(Locale::acceptFromHttp('zh_TW')); echo "<br>\n"; var_dump(setlocale(LC_ALL, 'zh_TW')); echo "<br>\n";
Output for 8.5.0 - 8.5.1
Fatal error: Uncaught Error: Class "Locale" not found in /in/4DkNT:5 Stack trace: #0 {main} thrown in /in/4DkNT on line 5
Process exited with code 255.
Output for 8.1.34, 8.2.30, 8.3.28 - 8.3.29, 8.4.15 - 8.4.16
string(10) "zh_Hant_TW" <br> bool(false) <br> string(10) "zh_Hant_TW" <br> bool(false) <br>
Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.27, 8.4.1 - 8.4.14
string(10) "zh_Hant_TW" <br> bool(false) <br> string(2) "zh" <br> bool(false) <br>

preferences:
59.91 ms | 409 KiB | 5 Q