Php vs html
PHP and HTML are compliments not competing languages. PHP is used to create dynamic HTML which will be sent to the viewer. You would not be able to create a shopping cart in just HTML. PHP is obviously going to be slower than HTML since it is computing dynamic code, wheras HTML is just reading the code from the file and sending it out. The difference wont be noticable unless you have the php engine doing something rediculous.
The extensions don't make code php or html. HTML code in a .php file is still HTML. by renaming a file to .php, it is simply telling the apache server to look out for php tags (<?php ?>) and if it finds any to engage the php engine.
They are different tools, each used for different jobs.
HTML stands for Hypertext Markup Language, and its basically a tool for displaying text in different ways using tags.
You could create a webpage in HTML, and that would be it. In order to update figures or information on your page, you would have to manually edit the information within the file and re-upload it. All you have is that webpage with nothing behind it.
PHP is what makes the content on your page dynamic. Often used hand in hand with MySQL (or any of the other popular semi-popular databases), PHP uses variables and other functions to do tasks that HTML cannot do.
PHP is handles the data, which can be obtained from people and stored, and HTML is used to format the data. Often called the frontend (HTML) which is what people see, and the backend (the PHP) which is what does the work.
If you wanted to create a shopping cart, you would need both languages. PHP to handle the data, mathematical calculations ... or to incorporate API from another source, to process information according to what you want to do with it, and to communicate with a database.
Then, you would use the HTML to format the results of what the PHP produces. If you didn't have HTML, the PHP output would be very basic, unformatted, and look like a big jumble of information. HTML allows the information to be put into tables, bolded, italisized ... allows linebreaks, headers, subheaders.



LinkBack URL
About LinkBacks



Reply With Quote

Bookmarks