How do I add HTML to a PHP function [closed]

You can use ‘echo’ (or ‘print’) to enclose HTML, but sometimes that gets a bit messy with complex HTML, not to mention having to escape quote/double-quote character.

So try something like this:

function myfunction() {
  // after this next, plain HTML
  ?>
  <div class="myclass"><h1 align="center">This is a heading</h1></div>
  <!-- more HTML code here -->
  <?php   // back to PHP
  // .. some more PHP stuff
return;
}

That allows you to put in some complex HTML (or a bunch of it) without having to use echo/print.