It really depends, I suppose you are working with $ _POST [] data and want to misinform these inputs? If so, I would definitely do something like:
$var = preg_replace("/[^A-Za-z0-9]/", "", $var);
This will separate everything except alpha / num, you can customize the regex to include other characters if you want. Some great examples of commonly used regular expressions can be found at: RegEx Library
If this is not exactly what you are looking for, or if you have other questions, let us know.
Nicholas kreidberg
source share