Saturday, August 13, 2011

Remove the special characters from the query string

Function to remove the special characters from the query string using PHP.

function trim_req($string){
$string=preg_replace('/[^A-Za-z0-9-]+/', '', $string);
$string = str_replace("<", "", $string);
$slug = str_replace(">", "", $string);
return $slug;
}




No comments: