Forum Moderators: coopster

Message Too Old, No Replies

I can not get rid of empty lines on a file

problems printing data from a file if blank lines

         

avlis odraude

3:56 pm on Mar 18, 2008 (gmt 0)

10+ Year Member



Hi to all,

I have a problems that is almost breaking my head.
I am trying to read files with php, and it is working perfectly well until the file comes with some empty lines (which happens frequently).

I have tried everything but I still do not have good results.
Could someone please help me with this?

henry0

4:47 pm on Mar 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld avlis odraude!

are you using a d-loaded CMS many will add tons of <p> and/or <br>

obviously the problem lies where the content is added
the following will probably get rid of "empty lines"
however it will not address the real issue:
Why is it happpening?

You might let us know how you content is entered.

in the meanwhile try this:
<?php
$str = str_replace('\r\n', '', $str)
?>
// where str is your text

<edit>Typo</edit>