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 1AQ6Y
Output for 4.3.0 - 7.1.0
Lee-dLee%-&*d#