How Does PHP works and Embedding PHP in HTML

How Does PHP works and Embedding PHP in HTML

How Does PHP works

Before knowing about the working of PHP you need to understand the difference between HTML and PHP.

The main difference between HTML and PHP is that PHP is used for making the page dynamic and it is the scripting language.

In HTML you write your code then deployed it and the user will download that page along with all the code.

The browser then interprets this code and shows the user the page as you planned for it. HTML code goes to the user same as it is and is interpreted by the browser.

But working with PHP is quite different because you don’t download the code in PHP. You need to know what happens when user request a PHP page? -The code in the requested file is processed by the server then you download the output of the code (in HTML form).

The main aim of working with PHP is to use the processing powers of the server to build the dynamic web pages. This means that if you click "view source" on a PHP page, you are not able to see the PHP codes you will see only HTML tags. Due to this you cannot see how a PHP page is made with the help of "view source".

Embedding PHP in HTML

Normally you embed HTML outside of PHP tags but you can also echo HTML elements within PHP tags.