PHP alpha numeric only strings

Oct, 17 -- Categories: PHP

$str = “@ % * alpha numeric 0 – 9 only _ – +@_#()()++”;
$str = preg_replace(‘/[^A-Za-z0-9]/’, ”, $str);

echo $str;
returns alphanumeric09only