Difference between PHP and HTML
Key difference: HyperText Markup Language (HTML) is a well known mark up language used to develop web pages. PHP is an open source server-side scripting language. It is mainly used for Web development and to produce dynamic Web pages. PHP is used in addition to HTML and the PHP code is in fact embedded into an HTML source document.
HyperText Markup Language (HTML) is a well known mark up language used to develop web pages. It has been around for a long time and is commonly used in webpage design. XML or Extensible Markup Language defines a set of rules for encoding documents in a format that can be read by both, human and computer.
HTML is written using HTML elements, which consist of tags, primarily and opening tag and a closing tag. The data between these tags is usually the content. The main objective of HTML is to allow web browsers to interpret and display the content written between the tags. The tags are designed to describe the page content. HTML comes with predefined tags. They allow one to insert images, text, videos, forms and other pieces of content together into a cohesive webpage. However these days, web pages are rarely only designed using HTML.
PHP originally stood for ‘Personal Home Page’ but it is now said to stand for ‘PHP: Hypertext Preprocessor.’ PHP is an open source server-side scripting language. It is mainly used for Web development and to produce dynamic Web pages. PHP is used in addition to HTML and the PHP code is in fact embedded into an HTML source document.
Essentially, HTML is used to develop static web pages that are the same every time they are opened. PHP can be used to add components to the static web page to make them more dynamic. The PHP code in the HTML source document is interpreted by a Web server with a PHP processor module, which in turn generates the resulting Web page.
Some of the dynamic components that can be added to a webpage through PHP include the current date and time, information from a database, widgets or data from form fields submitted by a user, such as a search box. Furthermore, the once the page reaches the user's Web browser, everything is formatted as HTML. So, the PHP does not have any impact on the formatting.
PHP now includes a command-line interface capability and can be used in standalone graphical applications. It can also be installed free of charge on most Web servers and as a standalone shell on almost every operating system and platform. Drupal, Joomla, MediaWiki, and WordPress are just some of the software that use PHP.
Image Courtesy: ilyasitnikov.com, lincgeek.org