Difference Between PHP and HTML


HyperText Markup Language, widely known as HTML is the leading markup language for web pages. HTML is the basic building block of web pages. Web browser reads the HTML document and composes them into visual or audible web pages. PHP (stands for PHP: Hypertext Preprocessor) is a server side scripting language, specially suited for developing dynamic and interactive web pages. PHP scripts can be embedded in to HTML documents.

What is HTML?

HTML, as mentioned earlier is a markup language, not a programming language. A markup language is a set of mark up tags and HTML uses markup tags, which are usually called HTML tags, to describe web pages. HTML documents describe web pages and they contain HTML tags and plain text. HTML tags could be identified easily in a HTML document since they are surrounded by angle brackets (e.g. <HTML>). HTML tags are typically inserted in to a document in pairs, where the first tag is the start tag (e.g. <b>) and the second tag is the end tag (e.g. </b>). The task of a web browser (e.g. Internet Explorer, Firefox, etc.) is to read a HTML document and display it as a web page. The browser uses the HTML tags to interpret the content of the page and the HTML tags themselves are not displayed by the browser. HTML pages can embed images, objects and scripts written in languages like JavaScript. Further, HTML can be used to create interactive forms.

What is PHP?

As mentioned earlier, PHP is a scripting language that is specially suited for developing dynamic web pages. PHP is open source software and it is free to download and use. PHP scripts are executed on the web server. PHP code in a requested file is executed by the PHP runtime and creates the dynamic web page content. PHP can be deployed in most web servers (Apache, IIS, etc.) and runs on different platforms such as Windows, Linux, UNIX, etc. PHP can also be used with many Relational Database Management Systems (RDBMS). Even though PHP was originally designed for creating dynamic web pages, it now focuses mainly on server-side scripting where it provides dynamic content from a web server to a client. PHP files can contain text, HTML tags and scripts. PHP files are processed by the web server and returned back to the browser as plain HTML. PHP files can be identified with the file extensions “.php”, “.php3”, or “.phtml”

Difference between HTML and PHP

The main difference between HTML and PHP is that HTML is a markup language that is used to specify the content of a web page, while PHP is a scripting language. Web pages created using only HTML are static web pages and they will always be the same every time they are opened. But PHP files can create dynamic web pages where the content might change from time to time. For example, dynamic web pages created with PHP can include objects like current date/time, data submitted by a user using a form or information from a database.