Originally Posted by shadowsai
I can easily replace every single occurrence of " ", but I have no idea how to do this.
$original = 'This had 5 spaces';
$fixed = str_replace(' ',' ',$original);
Doing that it doesn't matter if there is one space or 5 spaces. They will all be changed to a required space.