some data that contains special characters (e.g. single quote, double quote. special characters removed from a string using the preg_replace function.
In this tutorial, I will inform you how to remove the special character from string in PHP. we want to remove all special characters from the string by using preg_replace. So, its function will remove any special character except letter and numbers.
$data = preg_replace('/[^a-zA-Z0-9_ -]/s','',$string);