I have a string with multiple newlines.
The String:
This is a dummy text. I need
to format
this.
Desired Output:
This is a dummy text. I need to format this.
I'm using this:
$replacer = array("\r\n", "\n", "\r", "\t", " ");
$string = str_replace($replacer, "", $string);
But it is not working as desired/required. Some of the words don't have spaces between them.
Actually I need to convert the string with all the words separated by single spaces.