Hi,
I want to make a replacement of special characters through a string such as:
$str = "This is a small string : With Features & Stuff";
this should be replaced with :
This-is-a-small-string-With-Features-Stuff
I am aware we can do this by using preg_replace or ereg_replace, but the following code is not giving exact returns.
preg_replace("/[^a-zA-Z0-9\s]/", "\-", $str);
This returns:
This-is-a-small-string---With-Features---Stuff
I certainly don't want those extra ----s. What can I do?