+ Reply to Thread
Results 1 to 7 of 7

Thread: Line breaks have stopped working.

  1. #1
    f1.p183 is offline x10Hosting Member f1.p183 is an unknown quantity at this point
    Join Date
    May 2011
    Posts
    15

    Line breaks have stopped working.

    I can't get PHP_EOL or \r\n to give me a line break.

    I've not used my account for a few weeks and I recently logged in because I wanted to try changing some of my PHP Mysql to use PDO.

    Has anything been updated recently that would stop PHP_EOL line breaks from working ?
    Whenever I add PHP_EOL to an echoed string in single quotes now it no longer works and the output comes out as one long string.

    ie: echo 'This is a line of text'.PHP_EOL;
    echo 'And this is another'
    ouputs as This is a line of textand this is another

    Thanks in advance for any help.

  2. #2
    denzil is offline x10 Sophmore denzil is an unknown quantity at this point
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    134

    Re: Line breaks have stopped working.

    Just do: echo '<br />' or is it too much effort to update everywhere?
    Last edited by denzil; 08-13-2011 at 07:00 AM.

  3. #3
    f1.p183 is offline x10Hosting Member f1.p183 is an unknown quantity at this point
    Join Date
    May 2011
    Posts
    15

    Re: Line breaks have stopped working.

    Thanks for this suggestion denzil. I'm still quite new to php and I didn't know about this.

    Still curious as to why PHP_EOL and \r\n has stopped working but as this has the same effect I won't worry about it too much. Thanks again.

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: Line breaks have stopped working.

    When displayed as HTML PHP_EOL ( \n in *nix ), does not cause a line break unless you are between [ pre ] tags.
    Nothing is always absolutely so.

  5. #5
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: Line breaks have stopped working.

    <br/> isn't semantic. HTML is a structuring language, not a formatting one. When producing HTML, you shouldn't be thinking in terms of presentation but document structure. Pick appropriate elements (such as <p> or a list), then style the result with CSS. You can use the white-space property to preserve newlines in any element, or use margins to put space between elements.

    Note you can use [php], [html] or [code] tags (as appropriate) to separate and format code.

    For reference: §9.1 of the HTML standard describes how white space should be handled by user agents.
    Last edited by misson; 08-13-2011 at 04:16 PM.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

  6. #6
    callumacrae's Avatar
    callumacrae is offline not alex mac callumacrae is just really nice
    Join Date
    Dec 2007
    Location
    Wellesbourne, England
    Posts
    5,162

    Re: Line breaks have stopped working.

    PHP_EOL will never have worked as an HTML white space ;-)
    I can customise your phpBB board. Send me a PM.
    lynxphp - info, tutorials and scripts
    "A forum post should be like a skirt; long enough to cover the subject but short enough to keep things interesting."

  7. #7
    f1.p183 is offline x10Hosting Member f1.p183 is an unknown quantity at this point
    Join Date
    May 2011
    Posts
    15

    Re: Line breaks have stopped working.

    Thanks for all the replies. Most helpful.

+ Reply to Thread

Similar Threads

  1. URL stopped working
    By jonas_thorn_1691 in forum Free Hosting
    Replies: 6
    Last Post: 06-12-2011, 12:52 PM
  2. NO!!!!!!!!! It stopped working again...
    By kevinandskyforever80 in forum Free Hosting
    Replies: 4
    Last Post: 06-19-2010, 03:21 AM
  3. Python - shebang line not working
    By gpstrack in forum Programming Help
    Replies: 4
    Last Post: 11-15-2009, 10:59 AM
  4. why has this stopped working for me?
    By themasterrocker in forum Programming Help
    Replies: 0
    Last Post: 08-08-2008, 12:53 PM
  5. Line breaks in Form Data
    By Adam01 in forum Programming Help
    Replies: 8
    Last Post: 01-12-2008, 03:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers