sanitize php strings

Simple function to help you sanitizing the php string. This function will remove any non alphanumeric character.

[cc_php]
function sanitize($string)
{
return preg_replace(“/[^[:alnum:]]/ui”, ”, $string);
}
[/cc_php]

example:
[cc_php]
echo sanitize(‘café’); /* => café /
echo sanitize(‘|c/(!=)a f é’); /
=> café */
[/cc_php]