Remove new lines from string in PHP

Given a multiple line sentence or statement the task is to convert the whole statement in a
single line. See the example below.
Examples:
Input : Hello
welcome to zambiatek.
Output : Hello welcome to zambiatek.
Remove the new line between Hello and zambiatek.
Input : I
love
zambiatek
Output : I love zambiatek
The idea is to use str_replace()
<?php $text = "Hello \nwelcome to \nzambiatek"; echo $text; Â Â echo "\n"; $text = str_replace("\n", "", $text); echo $text; ?>Â |



