PHP - Replace new lines with single space in string
Posted: 21 Jan 2015, 14:27
Hello
How can I replace the new lines with a single space in a string in PHP?
For example I have this $str variable with a string content with multiple lines:
And I want to result this $str string:
How can I replace the new lines with a single space in a string in PHP?
For example I have this $str variable with a string content with multiple lines:
Code: Select all
$str = 'First line
Second row
Other line ...';
Code: Select all
$str = 'First line Second row Other line ...';