...

View Full Version : PHp noob (ASK)



likon
07-06-2007, 05:26 AM
I wonder why my code's output is like this
output:
line one line two ( in one line)

while the coding is
print "line one\n";
print "line two\n";

this should look like
output:
line one
line two ( in separate line)

is it because the book I am reading has older version .
and my xampp is newer version or what?
tHHHAAANKKK YOUUUUU

rfresh
07-06-2007, 05:42 AM
Are printing to a web page? Or are you printing to a file?

If you're printing to a web page, you'll want to replace the newline chars with <br> so your output will look like this:

line one
line two
etc.
etc.

likon
07-06-2007, 06:04 AM
oohh got it .
I print it to website
not really a website though
I typed it like <?php ?> and save as .php file.

so it came up not exactly like the book says,
thats why i was wondering .thank you...

jream
07-06-2007, 08:34 AM
Using \n and such is used a lot for email forms, it will format emails sent to you. Thats just something more practical :P



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum