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
LordJonsson
Forum Newbie
Posts: 3 Joined: Tue Sep 26, 2006 12:19 am
Post
by LordJonsson » Tue Sep 26, 2006 12:27 am
How can I get Escape sequences to work in my code?
Using:
PHP 5.2.0RC5-dev
Apache/2.2.3
php:
Result:
a b
But I want the result to be:
a
b
And i'm sorry if i'm one of thousans and thousands of people hwo asked this question on this forum.
Thx in advance.
Last edited by
LordJonsson on Tue Sep 26, 2006 12:58 am, edited 1 time in total.
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Tue Sep 26, 2006 12:30 am
Browsers don't render new lines. You need an <br /> in there.
LordJonsson
Forum Newbie
Posts: 3 Joined: Tue Sep 26, 2006 12:19 am
Post
by LordJonsson » Tue Sep 26, 2006 12:41 am
ohh c'mon so i'll always have to include nl2br("");?
What about if I want to put tab \t?
Benjamin
Site Administrator
Posts: 6935 Joined: Sun May 19, 2002 10:24 pm
Post
by Benjamin » Tue Sep 26, 2006 12:54 am
Browsers don't render multiple spaces either. Not sure about tabs so you might just want to test it.
Your other option is to do this..
Code: Select all
<pre>
<?php echo "this will render on\n2 lines"; ?>
</pre>
LordJonsson
Forum Newbie
Posts: 3 Joined: Tue Sep 26, 2006 12:19 am
Post
by LordJonsson » Tue Sep 26, 2006 12:57 am
Thx alot, if I put <pre> over all of my code the escape sequences work!