The following case-insensitive regular expression snippet will strip all non-alphanumeric characters from $string.
<?php$string = 'abc123_%$£';$string = preg_replace("/[^a-z\d]/i", "", $string);echo $string; // Result: abc123?>