file extensions | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

file extensions

why are some.html, .php, .asp, etc.? when does a web page become a .php instead of an .html? is .php best used when gathering data interactively from the user(s)? (also, trying to get another badge.)

30th Jul 2017, 6:47 PM
Ariel Strickland
Ariel Strickland - avatar
1 Answer
+ 2
If you put php code in a HTML file, it won't interpret it correctly and probably just spit out text. You can think of the file extension as telling the executing platform how to read the contents. Making a file .php will allow php commands to be interpreted as such. php is run server side and can be used in a user-responsive way. You can produce html dynamically based on any criteria, you have the power of a programming language at your disposal. Being compiled server side hides the code from the user and can be more secure than plain js
30th Jul 2017, 7:50 PM
Dan Walker
Dan Walker - avatar