escape sequences don't work

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
andrec
Forum Newbie
Posts: 6
Joined: Wed Jul 31, 2002 10:53 am

escape sequences don't work

Post by andrec »

hi all,


I have searched on this forum as well as tested it on both WIN32 and FreeBSD environment. I still don't know why a script as simple as the following has problem with the escape sequences. I tried also \t\r...etc and they just don't work as they are supposed to. I'd appreciate any help.

<?php
echo ("test\n");
echo ("test2");
?>
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

If you view your source, it probably worked. if you see:

Code: Select all

test
test2
then it did exactly what it was supposed to. If you want the browser to display a line break, then you can do:

Code: Select all

echo "test<br>";
echo "test2";
User avatar
andrec
Forum Newbie
Posts: 6
Joined: Wed Jul 31, 2002 10:53 am

Post by andrec »

If the escape sequences are only shown when you view source via your browser instead of interpreted by the browser naturally and displayed , I am curious what they are for.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

browsers are not everything.
And when you put a newline in a normal .html file it also doesn't show up.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

andrec wrote:If the escape sequences are only shown when you view source via your browser instead of interpreted by the browser naturally and displayed , I am curious what they are for.
Have you ever tried to debug HTML that's all on one line? It's a nightmare.

Mac
User avatar
andrec
Forum Newbie
Posts: 6
Joined: Wed Jul 31, 2002 10:53 am

Post by andrec »

I got the idea now. Thank you for all the replies.
User avatar
cheatboy00
Forum Contributor
Posts: 151
Joined: Sat Jun 29, 2002 10:36 am
Location: canada
Contact:

Post by cheatboy00 »

twigletmac wrote:
andrec wrote:Have you ever tried to debug HTML that's all on one line? It's a nightmare.

Mac
acutally i ahve and i do ... its fun!!!! :D :D :D
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Each to their own... :roll:

Mac
Post Reply