Special characters remove from string - PHP

by satheeshkumar 2012-06-27 12:46:17

Remove Special Character in String using PHP,

The following code is used to removes the special characters in a given string,

$var = "asd@#sdf$%()sdf*^=+|";
$rep = preg_replace('/[^a-zA-Z0-9_ -]/s', '', $var);
echo $rep;
758
like
0
dislike
0
mail
flag

You must LOGIN to add comments