3v4l.org

run code in 300+ PHP versions simultaneously
<?php function chars($a) { return addslashes(implode("", $a)); } $set = implode("", array_map("chr", range(32, 127))); var_dump(preg_match_all('/[A-\d]/', $set, $m) ? chars($m[0]) : null); var_dump(preg_match_all('/[\d-A]/', $set, $m) ? chars($m[0]) : null);
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
Warning: preg_match_all(): Compilation failed: invalid range in character class at offset 5 in /in/LC0hG on line 6 NULL Warning: preg_match_all(): Compilation failed: invalid range in character class at offset 3 in /in/LC0hG on line 7 NULL
Output for 7.3.16 - 7.3.33
string(37) "ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcd" Warning: preg_match_all(): Compilation failed: invalid range in character class at offset 3 in /in/LC0hG on line 7 NULL
Output for 7.1.0 - 7.1.20, 7.2.0 - 7.2.33
Warning: preg_match_all(): Compilation failed: invalid range in character class at offset 4 in /in/LC0hG on line 6 NULL string(12) "-0123456789A"

preferences:
85.28 ms | 409 KiB | 5 Q