Why do HTML files need to be saved as .php when using PHP code within them?

HTML files need to be saved as .php when using PHP code within them because PHP code needs to be processed by a server-side interpreter before being sent to the client's browser. By saving the file as .php, the server knows to interpret the PHP code within the file. To implement this, simply change the file extension from .html to .php.

// Change the file extension from .html to .php