I believe that this topic is very important to discuss a little bit since it is making some confusion for me. I want to know if I use php code in html page, is that the same level of security as when I use php code in php page? how about the opposite way? I tested a php code to whether I can see it or not on localhost and web server and it turned out that nether show the php code. Does that mean both page format are the same?? so why do we have to have different types if that’s true then?
are there a substantial or essential meaning or benefits of having php over html as some article suggest? for me, I see both do the same job.
I want to hear your opinions if you don’t mind.
Thanks
When you write PHP, you’re essentially writing a program that outputs HTML. PHP runs server-side. The browser has no knowledge that the HTML page was created in PHP.
As far as “page format”, you are simply referring to the file name extension,
.phpor.html. These are meaningless to the browser. The browser only cares aboutContent-Typewhich is a header sent outside of the page itself.The file name extension is mainly useful for telling your web server what to do with the file. When it sees
.php, it passes the page contents off to PHP to process. PHP then passes the output back to the server, and the server sends it to the browser.