Both of those approaches are poor for anyone that's not a beginner, or anything outside of a very small standalone script. Beyond a small-sized website or application, a templating engine is normally used to inject PHP data into HTML templates. The syntax of these templates differs by vendor, but typically follows something along the lines of:
<p>Hello {{ name }}</p>
The templating engine is then responsible for loading the HTML, injecting the relevant data from some type of PHP model, and then printing the result, which would of course look something like:
<p>Hello Marty</p>
There are plenty of different engines to chose from, some of which include: