Forum Moderators: coopster

Message Too Old, No Replies

new line in php

         

rekhad

10:55 pm on Mar 2, 2006 (gmt 0)

10+ Year Member



Simple question

why does
print"$good\n";
print"$bad";
both variables are printed on the same line?
same is true with echo.

jatar_k

10:56 pm on Mar 2, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



view source and you should see them on seperate lines as you intended

the browser doesn't know what a newline is you would have to use <br>

rekhad

11:16 pm on Mar 2, 2006 (gmt 0)

10+ Year Member



Thanks...
I am learning php/mysql with the help of this site

coopster

1:20 am on Mar 3, 2006 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Newlines are recognized and rendered in the browser though when you use the HTML <pre> tags:
print'<pre>'; 
print"$good\n";
print"$bad";
print'</pre>';