Jump to content

Archived

This topic is now archived and is closed to further replies.

Chat

echo function - can it be over several lines?

Recommended Posts

Is there anything technically wrong with this code:

[code]
<?php

echo "
<!-- BEGIN SECTION -->
<div>
<a href=\"#\"></a>
</div>
<!-- END SECTION -->
";

?>
[/code]

I just found that when I added \n to the end of each line, I was getting two line breaks between each line in the HTML source code, so I took the \n away from every line. Is there anything wrong with leaving the echo over several lines like this?

Share this post


Link to post
Share on other sites
not that I can see.
If you read the explanation of echo you can see an example:
[code]<?php
echo "This spans
multiple lines. The newlines will be
output as well";
?>[/code]

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.