Filter Non-Alphanumeric Characters

Description: Filters out all non-alphanumeric characters (a through z and 0 through 9). Useful for filtering or sanitizing input data.

<?PHP
 
//Begin filtering variable  $data of non alphanumeric characters
 
$data = PREG_REPLACE("/[^0-9a-zA-Z]/i", '', $data);
 
//Finish filtering of non alphanumeric characters
 
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.