PHP: Can anyone tell me why escape characters '\n' and '\t' are not parsing at home?

Discussion in 'Computers' started by TheoGB, Aug 5, 2004.

  1. TheoGB

    TheoGB Screenwriter

    Joined:
    Jun 18, 2001
    Messages:
    1,744
    Likes Received:
    0
    As the title really.

    I have PHP 4.3.8 on my site (courtesy of my hosting company) - http://www.theogb.com/test.php

    On there, if i use a line like:

    PHP:
     echo 'ntHello';  


    Then if you view the source of the created page you'll see the statement on a new line and tabbed in, making debugging and reading much easier.

    But at home (where I have 4.3.0 installed) this doesn't seem to be happening.

    I'm a little confused.

    Is it because the code I have running currently at my site is in an include file and not embedded in the HTML? Or is one of my flags not set correctly or what?

    I have tried with both " and ' quotes.

    I'm running Apache 2.0.50 for Windows and obviously the hoster is running a Unix version, but I'm not sure what version it is. Still, I wouldn't expect that to make much difference.

    Cheers. [​IMG]
     
  2. nolesrule

    nolesrule Producer

    Joined:
    Aug 6, 2001
    Messages:
    3,084
    Likes Received:
    0
    Location:
    Clearwater, FL
    Real Name:
    Joe Kauffman
    It's been awhile, since I've looked it over, but I recall that Unix and Windows don't handle escaped characters identically at the server level.

    Since you didn't say exactly what is happening in the output on the Windows machine (ie, is it the tab that isn't happening or the new line?), it's hard to be sure. But you may need to use "rn" or "nr" in code on the Windows machine...can't remember which though.
     
  3. TheoGB

    TheoGB Screenwriter

    Joined:
    Jun 18, 2001
    Messages:
    1,744
    Likes Received:
    0
    Thanks Joe.

    The problem I'm having is that it's just treating it as text and displaying n.

    That said...I have a feeling it put each one on a new line so I'll check again when I get home and get back to you...

    Cheers
    Theo
     
  4. TheoGB

    TheoGB Screenwriter

    Joined:
    Jun 18, 2001
    Messages:
    1,744
    Likes Received:
    0
    Okay, apologies, I was just being a muppet. :b

    The escape chars only work inside " quotes of course.

    I'm sure I tried it in "" so either I'm going mad or there was something else at work, in which case I'll track that and add more. D'oh! [​IMG]

    Cheers
     

Share This Page