PHP is different from HTML?

Open 2 Answers 26 Views World Wide Web
How is PHP different from HTML? Is the latter for web use only?

2 Answers


PHP files are just like HTML files, but they can include both HTML and PHP code. The PHP code is parsed (or executed) by the Web server when the page is accessed and the resulting output is written as HTML within the Web page. When a user accesses a PHP page, his Web browser only gets sent the HTML code, since the Web server has processed the PHP code in the background. Most PHP pages are processed so quickly that it does not noticeably slow down the loading of the Web page.

The .php extension is important, since it tells the Web server that the page may include PHP code. Therefore, it must be run through the server's PHP engine before being sent to a client's Web browser. This allows dynamic content to be generated each time the Web page is loaded, based on the variables included in the PHP code. For example, PHP pages may load objects such as the current date and time, data from form fields submitted by a user, or information from a database. Still, once the page reaches the user's Web browser, everything is formatted as HTML.

answered Jun 6, 2016 by techydenz New Member (2,240 points)
Typically, the use of CSS is to change the overall look and design of your website, while HTML is there to put the main structure in place. HTML and CSS are linked and both almost bounce off each other to create your website.
answered Jun 12, 2016 by BradR New Member (1,500 points)