string - Does echo in PHP starts printing on a new line? If no then why it's happening in my case? -
i've following php code:
<!doctype html> <html> <body> <?php echo "<h2>php fun!</h2>"; echo "hello world!<br>"; ?> </body> </html>
i'm not understanding why without adding <br>
@ end of first echo statement next echo statement printing data on new line?
the same not happening in below example :
<!doctype html> <html> <body> <?php echo "jumbo"; echo "hello world!<br>"; ?> </body> </html>
i'm getting output jumbohello world!
why so? mean @ 1 place echo takes new line charcter before start printing text , @ place it's not.
please clear concept me in detail manner.
thanks.
when "new line" referring visually when viewing page in browser. in html have block-level elements, default appear on own line, , there line breaks, defined <br>
echo
not add other tell output.
<h2>
block-level element default, in first example, hello world!
appear below it.
in second example, outputting <br>
tag after text, meaning line break after hello world
Comments
Post a Comment