Echo <<?

How do I echo a lot of html code, I thought there was a function like


echo >>end
...
...
html code
...
...
end;

to output html without worrying about quotes and semicolons all the time

Not something I tend to use or have used for a long time, but I think what you need is

echo <<<__HTML_END
<!-- HTML here -->
__HTML_END;

You’re thinking of Heredoc. You need to remember with heredoc that the opening and closing “tags” can’t be indented at all.l

Also


<?php
echo <<<FOOBAR
Hello World!
FOOBAR;
?>

is the same with


<?php
echo <<<"FOOBAR"
Hello World!
FOOBAR;
?>

but not with


<?php
echo <<<'FOOBAR'
Hello World!
FOOBAR;
?>

if you need variables into your text.

Much easier to flip around the other way and use <?php ?> when you need to do something

ok, thanks