I'm learning how the internet and websites work. I think I understand how .php files get processed by the PHP processor:
Browser requests webpage ending in .php and sends request to server for that webpage.
Server asks 'can I find that page?'
If server does not find it, server sends back error.
If server finds page, server asks 'does file extension end in .html or .php'?
If it ends in .html, server send page back to browser.
If it ends in .php, hand page to PHP processor.
PHP processor scans the page, line by line. It build a processed HTML page.
If it finds HTML, it passes that on as part of the processed HTML page it is building.
If it finds PHP scripts, the PHP processor may or may not output HTML.
When the PHP processor is done, the processed page is handed to the web server for sending to the browser.
In summary, a web page that has PHP code in it needs be have a .php extension. Once the PHP processor encounters
HTML is the language of the web. It is a markup language which means that the only thing we can use it for is to "markup" documents, i.e. design how content will look to the end user.
Imagine we had a page that showed the user the date.
We could use some HTML to do that:
<p>Sunday 26 August 2012</p>
But say we wanted to keep that page up to date. We'd have to go and manual change the date manually everyday. Because HTML is static, it can't be changed dynamically.
Perhaps it would be useful to be able to generate automatically adding the correct date to the page, depending on when the page is loaded.
That is where PHP comes in. PHP is a scripting language, and while it can be used for lots of things, one of its main uses is to generate HTML dynamically. So instead of writing in today's date - what we could do is use some PHP and say.
<p><? echo date("l j F Y");?></p>
This will print out for me "Sunday 26 August 2012" today, "Monday 27 August 2012" tomorrow, and so on.
I'd need to save this new version of my page as page.php instead of page.html, because I need my server (which is set up use the PHP) to send the page to PHP interpreter. It will look for the special
<? and try to process what ever it finds. In this case it spits out the correct text for the date on my page and adds it to the page before sending it to the user.
We can do lots of cool stuff with PHP. It is "server side" technology, meaning that it does its work on the server and then sends us the finished page with all the dynamic content added.
I hope this helps you work out how different technologies can help you achieve different things.
The TL;DR version of this would be:
HTML & CSS - sets out how your pages are going to look.
PHP - helps you to generate HTML dynamically.