PHP is a scripting language built specifically for the web. Unlike HTML, CSS, and JavaScript — which all run in the visitor's browser — PHP runs on the server, before the page ever reaches a browser. It reads data, talks to a database, decides what content to show, and hands the finished HTML off to be displayed.
Every website you've built so far with HTML, CSS, and JavaScript runs entirely on the visitor's device — that's client-side. Open the page, and the browser does all the work locally.
PHP is different. It runs on the server — the computer hosting the website — before anything is sent to the visitor. By the time a PHP-powered page reaches a browser, PHP has already finished its job; the browser only ever sees the plain HTML it produced. This is why "View Source" on a PHP page never shows any PHP code, only the HTML it generated.
| Runs where | Can it see a database directly? | Examples | |
|---|---|---|---|
| Client-side | The visitor's browser | No | HTML, CSS, JavaScript |
| Server-side | The web server | Yes | PHP, Python, Node.js |
PHP has been around since 1995, and despite plenty of newer competition, it still powers a huge share of the web — including WordPress, which alone runs a large percentage of all websites. That matters practically: PHP skills are directly useful for building, customizing, or troubleshooting WordPress sites, e-commerce platforms, and countless custom web applications still running in production today.
Because PHP runs on the server, it can do things a browser alone never could: read and write files, remember who's logged in between page visits, and — most importantly — talk to a database. That last one is the real reason PHP exists: it's what lets a website show different content to different people, pulled from stored data, instead of the same fixed HTML every time.
Coming from Intro to Programming
This category assumes you're already comfortable with the general programming ideas — variables, loops, functions, and so on — from the Intro to Programming section, and with HTML from the HTML section. If either of those feels shaky, it's worth a detour there first; this section moves straight into PHP's own syntax.
The next lesson gets PHP actually running on your machine, so every example from here on is something you can try yourself.