Jump to content


Photo

echo function - can it be over several lines?


  • Please log in to reply
1 reply to this topic

#1 Chat

Chat
  • Members
  • PipPip
  • Member
  • 28 posts
  • LocationBirmingham (UK)

Posted 28 July 2006 - 12:37 PM

Is there anything technically wrong with this code:

<?php

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

?>

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?

#2 XeroXer

XeroXer
  • Members
  • PipPipPip
  • Advanced Member
  • 80 posts
  • LocationSweden

Posted 28 July 2006 - 12:40 PM

not that I can see.
If you read the explanation of echo you can see an example:
<?php
echo "This spans
multiple lines. The newlines will be
output as well";
?>

// XeroXer




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users