3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function clean($string) { $string = str_replace(' ', '', $string); return preg_replace('/[^A-Za-z0-9\-]', '', $string); } $string = 'Lee%-&*d#'; echo clean($string); echo $string;
based on F7qKR
Output for 4.3.11 - 5.6.28, 7.0.0 - 7.1.0
Warning: preg_replace(): No ending delimiter '/' found in /in/1AQ6Y on line 5 Lee%-&*d#
Output for hhvm-3.10.0 - 3.12.0
Warning: No ending delimiter '/' found: [/[^A-Za-z0-9\-]] in /in/1AQ6Y on line 5 Lee%-&*d#
Output for 4.3.0 - 4.3.10
Warning: No ending delimiter '/' found in /in/1AQ6Y on line 5 Lee%-&*d#