I have a bit of a problem. I am opening a file that has been exported from access with fopen(), reading it to a variable with fread() and then closing it. these files unfortunately have a LOT of blank lines. ex(one of them has over 50,000 blank lines). So i am trying to do a strreplace on the variable that contains the document, but i'm lost as to what string to search for.

Any help would be appreciated.

Recommended Answers

All 2 Replies

$newstring = str_replace('\r\n', '', $string)

or

$newstring = preg_replace('/\r\n/i', '', $string);

If that doesn't work use \n without the \r

thanks, that works great.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.