# PHP - Problem replacing new lines

**URL:** <https://forum.kirupa.com/t/php-problem-replacing-new-lines/249557>\
**Category:** programming\
**Created:** [January 20, 2008, 3:41am UTC](https://forum.kirupa.com/t/php-problem-replacing-new-lines/249557 "2008-01-20T03:41:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dinchu37](https://avatars.discourse-cdn.com/v4/letter/d/c57346/32.png) [@dinchu37](https://forum.kirupa.com/u/dinchu37)\
**Post date:** [January 20, 2008, 3:41am UTC](https://forum.kirupa.com/t/php-problem-replacing-new-lines/249557/1 "2008-01-20T03:41:24Z")

</div>

i have a script that reads a html doc and i cannot find a function that allows me to replace an empty line for a “backspace”, i tried replacing but i still getting an empty line.  
i also need a function that allows me to do the inverse, convert spaces into new lines. thanks you all any help will be apreciated.

for example a have this

name  
telephone  
address

and i want to get this:

name telephone address

it’s a html file with \<pre\> tags and no other tags between
