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?
You have a variety of options. One would be to use PHP as the template engine it is:
Another would be to use single quotes, which let you leave double quotes unquoted and also support newlines in literals:
Another would be to use a HEREDOC, which leaves double quotes untouched, supports newlines, and also expands any variables inside:
You can replace '<' with
<
and '>' with>
for ex:output will be visible
<div>
for longer strings make a function, for ex
Don't forget to put backslashes
href=\"#\"
or do it with single quoteshref='#'
or change it in a function too with str_replaceThis will also work fine with double quotes. To echo any html_tag with double quotes we just need to remember one thing, DO NOT USE ANY OTHER DOUBLE QUOTES(") IN THE MIDDLE.
Notice here the link inside the php echo is enclosed within the single quotes. This is the precaution you should take while using the double quotes for this purpose.
Using the first mechanism given there will do it.
Separating HTML from PHP is the best method. It's less confusing and easy to debug.
no need to use echo sir just use the tag . welcome :)