Using the preg_replace function you can easily replace all characters in a string that are not alphanumeric. This can be useful for sanitizing a string or user input.
$newString = preg_replace("/[^A-Za-z0-9 ]/", "", $text);
	Using the preg_replace function you can easily replace all characters in a string that are not alphanumeric. This can be useful for sanitizing a string or user input.
$newString = preg_replace("/[^A-Za-z0-9 ]/", "", $text);