Using Echo and print to dynamically build HTML files

I have searched this forum and have read a couple of your articles such as

http://www.kirupa.com/web/phphtml.htm.

however I’m still unsure whether I should use Echo (that I use on the command

line) or print – what is the difference?

The reason I ask is because I have written a few HTML files using PHP and I end up

with one extremely long line of HTML! It is still valid and the Web browser

displays the page correctly however I want to display the HTML in a much more

readable form (each tag on its own line).I have tried Echo and print and they both

appeared to be the same.

for example:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>

<?php
print “<p>Can gophers really code PHP?</p>”;
print “<p> if I can they can </p>”;
print “<p> I’m getting bored now </p>”;
?>
</body>
</html>

Results in the following HTML file (same with the echo command): –
<html>
<body>
<p>Can gophers really code PHP?</p><p> if I can they can </p><p> I’m getting bored

now </p></body>
</html>

whereas I want: –
<html>
<body>
<p>Can gophers really code PHP?</p>
<p> if I can they can </p>
<p> I’m getting bored now </p></body>
</html>

I have played about a bit will escape characters but I have been unable to achieve

the desired result.

Can anyone help me with this? Any thoughts greatly appreciated.

hhh