Here is a function which will replace all special character from a string.
We can write a regx to check all character number ,space and – , and we can replace everything with –
Below is sample for how to replace all special character from a string using regx
$variable = "word"; preg_replace('/[^A-Za-z0-9\- ]/', '-', $variable);
Hope it will help some one
1,894 total views, 23 views today