we are trying to escape some special character from our string please tell me the function that we have to use
e.g. HTC Desire 210 – White
In this example we escape -(hyphen) special character.
In above example we have lot of product name with different different special character that we escape it.
thanks for your co-operation.
Pass string in this function.
function clean($string){
$string = str_replace(' ', '-', $string); // Replaces spaces with hyphens.
return preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars.
}
For more info, check this Remove Special Character - Stackoverflow
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With