I want to remove all line breaks followed by a whitespace or in other words; move all lines that starts with a whitespace to the end of the last line.
Example:
$str_before = "Lorem Ipsum is simply dummy text
of the printing and typesetting industry.
Lorem Ipsum has been the industry's
standard dummy text ever since the";
Wanted result:
$str_after = "Lorem Ipsum is simply dummy text of the printing and typesetting industry.
Lorem Ipsum has been the industry's
standard dummy text ever since the";
I have tried this with no success:
$str_after = str_replace("\n"." "," ", $str_before)
How do I achieve this using php/regex?