No words...
\r
In General, the future of first task set, and then decide. Judging from the explanation you need to remove "\" and "\\r" and replace any sequence of 1 space (most likely a possible exception, but they are known only to you). So if this can get any blank characters, you can write:
\r
$text=preg_replace('/\\s+/',' ',$text);# replace all sequences of blanks to 1 blank
\r
Or the same with the enum in the array using str_replace (I would have stopped in the regular season).
\r
This code will replace any sequence of characters included in "\\s", for 1 space.
\r
And spravochku php read, because there is about a difference in " and ' written, and about the function used in the example, a lot of things so interesting.