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 "\n"; echo $string;
based on WfLud
Output for 4.3.0 - 5.6.21, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Lee-d Lee%-&*d#