3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(setlocale('LC_ALL', 'en_SG')); var_dump(preg_match_all('/\\w+/u', "-foo-barлолbaz-", $m), $m);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: setlocale(): Argument #1 ($category) must be of type int, string given in /in/orZi2:2 Stack trace: #0 /in/orZi2(2): setlocale('LC_ALL', 'en_SG') #1 {main} thrown in /in/orZi2 on line 2
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: setlocale() expects parameter 1 to be int, string given in /in/orZi2 on line 2 NULL int(2) array(1) { [0]=> array(2) { [0]=> string(3) "foo" [1]=> string(12) "barлолbaz" } }
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33
Warning: setlocale() expects parameter 1 to be integer, string given in /in/orZi2 on line 2 NULL int(2) array(1) { [0]=> array(2) { [0]=> string(3) "foo" [1]=> string(12) "barлолbaz" } }
Output for 5.5.24 - 5.5.35, 5.6.8 - 5.6.28
Deprecated: setlocale(): Passing locale category name as string is deprecated. Use the LC_* -constants instead in /in/orZi2 on line 2 bool(false) int(2) array(1) { [0]=> array(2) { [0]=> string(3) "foo" [1]=> string(12) "barлолbaz" } }

preferences:
173.65 ms | 402 KiB | 200 Q