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.16, 8.0.0 - 8.0.3
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.28
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"