Let's say I have a string like this:
$string = "hello---world";
How would I go about replacing the --- with a single hyphen? The string could easily look like this instead:
$string = "hello--world----what-up";
The desired result should be:
$string = "hello-world-what-up";
$string = preg_replace('/-{2,}/','-',$string);