PHP code is not working on my website; displays the code

By default, it’s vital to have your PHP code in .php files, because .php files are started on most servers to be handled by the PHP interpreter (the software on each server to be able to use the PHP programming language). If you add such code to .html files, it’ll not truly do anything, as a result of those files aren’t set to be parsed (rendered / executed) by the PHP interpreter.

This is quite basic for several people, however beginners to PHP or web development might not realise this.