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)
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)
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.
File extensions are merely a convention. You can save a JPEG picture with .html
extension and configure things to get it properly loaded. And, of course, being a convention, there's nothing magical in them: renaming foo.mpg
to foo.avi
won't convert your movie to DivX. The Unix operating system doesn't even use extensions to identify programs.
But, of course, they're a very useful convention. If your text editor opens a .php
file, it doesn't need to guess what syntax highlighter to apply. If the web server serves a .php
files, you don't have to instruct it to handle it to the PHP interpreter.
Some more remarks: