Click to See Complete Forum and Search --> : Extra \n where unnecessary...


King Zarathu
December 22nd, 2007, 02:05 PM
We have several include_once()s in our code, of which those included PHP files also contain include_once() functions. At the end, a series of 5-6 \n are printed out. What is the cause of this, and how can we fix it?

PeejAvery
December 23rd, 2007, 11:30 PM
You end with 5-6 line returns or actual "\n"?

Either way, somehow one of those included files is echoing those characters.

ludakot
January 11th, 2008, 08:35 AM
preg_replace(array('\n+', '\r+'), '',$output); perhaps?
But now that would remove *all* new lines and returns, you probably don't want that, so I guess (\n{5,6}) and (\r{5,6}) should do the trick.

Ali Imran
January 14th, 2008, 10:53 AM
The cuase may be either \n or \r characters before <? and/or \n or \r after ?> have been saved within the code files.

I also want to add here, that your script will not work perfect when saving cookeis on client's computer, as well as some more header() calls may result in error such as

'header already sent, output stated at line ###'.

regards