How Does PHP Work

The most important thing to understand is the difference between HTML and PHP. In HTML you write your code, deployed it, and the user's will subsequently download that page along with all the code. The browser interprets this code and shows the user the page as you intended it. In other words HTML code goes to the user as it is and is interpreted by the browser.

But with PHP it works quite differently because you don't actually download the code. What happens when user request an PHP page, the code in the requested file is first processed by the server, and you download the output of the code (in HTML form), as opposed to the whole code as is.

With PHP the goal is to use the processing powers of the server to build (usually) dynamic web pages. This means that if you click "view source" on a PHP page, you do not see the PHP codes - only basic HTML tags. Therefore, you cannot see how a PHP page is made by using "view source"