You can jump out of PHP and directly enter HTML:
<?php $var = "foo"; ?> <div> <ul> <li>Foo</li> </ul> </div> <?php $foo = "var"; ?>
If all you do is echo / print, I think it is a lot cleaner. In addition, you do not need to run and avoid single / double quotes inside the HTML itself.
If you need to save HTML in a variable, you can use HEREDOC :
$str = <<<EOD <div> <ul> <li>Foo</li> </ul> </div> EOD;
source share