I went through this before posting:
And still couldn't make it work.
I'm trying to echo this:
<div>
<h3><a href="#">First</a></h3>
<div>Lorem ipsum dolor sit amet.</div>
</div>
<div>
But I still can't find a way to make the tags "" and '' disappear, what do I have to do?
Just put it in single quotes.
Did you try the heredoc based solution:
You need to escape the
"
so that PHP doesn't recognise them as part of your PHP code. You do this by using the\
escape character.So, your code would look like this:
If you want to output large quantities of HTML you should consider using heredoc or nowdoc syntax. This will allow you to write your strings without the need for escaping.
Also note that because PHP is an embedded language you can add it between you HTML content and you don't need to echo any tags.
Also if you just want to output a variable you should use the short-hand output tags
<?=$var?>
. This is equivalent to<?php echo $var; ?>
.Here i have added code, the way you want line by line. The back tick helps you to echo multiple line code.