CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2007
    Posts
    17

    Extra \n where unnecessary...

    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?

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: Extra \n where unnecessary...

    You end with 5-6 line returns or actual "\n"?

    Either way, somehow one of those included files is echoing those characters.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jan 2008
    Posts
    20

    Re: Extra \n where unnecessary...

    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.
    Last edited by ludakot; January 11th, 2008 at 08:37 AM.

  4. #4
    Join Date
    Nov 2004
    Location
    Pakistan
    Posts
    466

    Re: Extra \n where unnecessary...

    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
    Last edited by Ali Imran; January 14th, 2008 at 10:56 AM.
    » Please 'Rate This Post' if it helped (encourage us to help you more)
    » Build GUI in minute using rad c++
    » Free IDE + GUI code generator - screenshot
    » Free WINAPI sourcecode and tutorials

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured