As far as PHP is concerned (or really, a web server in general), an HTML page is nothing more complicated than a big string.
All the fancy work you can do with language like PHP - reading from databases and web services and all that - the ultimate end goal is the exact same basic principle: generate a string of HTML*.
There are many ways to do this, but here are a couple.
Using just PHP:
Escaping from php mode to direct output mode:
// some php stuff