I'm confused. I must have read the following snippet somewhere and just assumed (stupid, that) that it actually does replace multiple whitespace characters with single spaces, as was advertised.
str_replace(' ', ' ', ...etc.
Instead, I found that I've had to resort to the more intensive preg replace:
preg_replace('/\\s+/', ' ', ...etc.
So what dumb thing did I do wrong with that string replace format?