HTML vs PHP File Extensions

copywriter's picture

Hello...

I noticed that Jeremy uses .php extensions for his files.

When do you use a .html file extension and when do you use a .php file extension?

And, can a website have BOTH .html file extensions and .php file extensions or do all the file extensions have to be the same throughout the website (all .html or all .php extensions)?

Thank you!

HTML vs PHP File Extensions

SKaze's picture

Hi,

.php files are, as the name says, PHP scripts and interpreted at runtime by the webserver which results in HTML code in the visitor's browser. So they are not much different from HTML except that you can change the resulting HTML dynamically and reuse code easily.

With webservers that support PHP (thats pretty much all of them nowadays) you can use .html and .php files interchangingly.

Regards,
Sergey

HTML vs PHP File Extensions

Jeremy Palmer's picture

I like using .php file extensions. This gives me flexibility to add dynamic functionality at a later time. Not all hosts will parse .html as .php.

Best,

Jeremy

Syndicate content