Below code will remove all special charaters except white spaces, For example, is we input a string “Hello vijaya#$%kumar&%”, it will returns string as “Hello vijayakumar”. I hope it will useful for some programmers, easy to implement. Try this and comment.
<?php
function alphanumericAndSpace( $string )
{
return preg_replace(‘/[^a-zA-Z0-9\s]/’, ”, $string);
}
?>



Posted in
Tags: