3v4l.org

run code in 200+ php & hhvm versions
<?php var_dump(preg_replace( '/[^_-\s]/' , '' , 'a b c d _ x' ));
based on FZ9Xu
Output for 7.4.0alpha1 - 7.4.0alpha2
Warning: preg_replace(): Compilation failed: invalid range in character class at offset 6 in /in/KICjT on line 3 NULL
Output for 7.3.0 - 7.3.7
string(5) "abcd_"
Output for 7.1.25 - 7.2.20
Warning: preg_replace(): Compilation failed: invalid range in character class at offset 5 in /in/KICjT on line 3 NULL