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
djwk
Forum Commoner
Posts: 56 Joined: Tue Mar 07, 2006 2:14 pm
Post
by djwk » Tue Jan 23, 2007 5:58 am
Ok
Here's my code:
$1 = $1 + "\n".$2;
And here's the output
07
I want the output to be:
0
7
I just can't figure out what I'm doing wrong, anyone?
volka
DevNet Evangelist
Posts: 8391 Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger
Post
by volka » Tue Jan 23, 2007 6:13 am
This output is displayed in a html browser?
Then you need <br /> instead of \n
You might be interested in
http://de3.php.net/nl2br
djwk
Forum Commoner
Posts: 56 Joined: Tue Mar 07, 2006 2:14 pm
Post
by djwk » Tue Jan 23, 2007 6:14 am
Ahh sorry, I hadn't actually saved it to a text file.. sorry for wasting your time
aaronhall
DevNet Resident
Posts: 1040 Joined: Tue Aug 13, 2002 5:10 pm
Location: Back in Phoenix, missing the microbrews
Contact:
Post
by aaronhall » Tue Jan 23, 2007 6:15 am
Or stick <pre> tags around the output if you must use \n
djwk
Forum Commoner
Posts: 56 Joined: Tue Mar 07, 2006 2:14 pm
Post
by djwk » Tue Jan 23, 2007 8:12 am
I've done it to a file now and it's not doing a new line
It has the value of $1 then the little square symbol thing then the value of $2...
Any help?
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Tue Jan 23, 2007 8:18 am
\r\n or try the PHP_EOL constant (if you are running PHP 4.3.10+ or PHP 5.0.2+)
djwk
Forum Commoner
Posts: 56 Joined: Tue Mar 07, 2006 2:14 pm
Post
by djwk » Tue Jan 23, 2007 8:20 am
I've fixed it now, nevermind, thanks for all your help
Kieran Huggins
DevNet Master
Posts: 3635 Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:
Post
by Kieran Huggins » Tue Jan 23, 2007 12:57 pm
or set the header to text/plain...
we can't stop!!!!!