Search code examples
phphtmlorganizationembedding

If you can embedd php into a .html file, why would you use .php?


Is there a reason why certain pages are made as .php when you can put php into a .html file? Is it simply for the sake of organizing your files? Or does it affect how the page loads?

(I'm talking about the file extension)


Solution

  • Whether files with the extension .html are parsed as PHP is down to the server's configuration. Usually, they're not.

    That is for a reason: When set that way, the PHP interpreter has to look over every HTML file that gets served, even if it doesn't contain any PHP code at all. That's not good for performance.