What PHP Is and Where It Came From
Pageturn is a small online bookshop. Every visitor should see today's prices and whether Dune is in stock, so the page must be built fresh for each request. That is the job PHP was made for.
The rule
PHP runs on the server, builds the page, and sends only the result.
What it is. PHP is a general-purpose scripting language that is best known for building web pages on the server. The name is a recursive acronym: PHP: Hypertext Preprocessor. A PHP file can mix plain HTML with code:
<p>Dune costs <?php echo 9.99; ?> today.</p>The browser asks for the page, the web server hands the file to PHP, PHP runs the code, and the browser receives only <p>Dune costs 9.99 today.</p>. The visitor never sees the PHP source.
Where it came from. In 1994 Rasmus Lerdorf wrote a few small tools to track visits to his personal home page. Others wanted them, and they grew into a language. Key milestones:
- PHP 3 (1998): rewritten by Andi Gutmans and Zeev Suraski; the first version that looks like modern PHP.
- PHP 4 (2000): the Zend Engine arrived underneath.
- PHP 5 (2004): proper classes and objects.
- PHP 7 (2015): roughly twice as fast, plus type declarations for scalar values. (PHP 6 was abandoned, so the numbering skipped it.)
- PHP 8 (2020 onward):
match, named arguments, the nullsafe operator?->, union types and a JIT compiler; later 8.x releases added enums, readonly properties and more.
This course uses PHP 8.x; check the date on older tutorials before copying a pattern.
Running it yourself. Beginners often install a bundle that packages a web server, PHP and a database together: XAMPP (any system), WAMP (Windows), MAMP (macOS) or a LAMP setup on Linux. You only need PHP itself to start, though: php -S localhost:8000 runs a small built-in development server in the current folder.
The shortcut
When you meet any PHP snippet, ask "what arrives at the browser?" Picture the server running the code first, then imagine the plain text that is left.
The browser asks
A visitor opens
/book.php. The request goes to the web server.
The common mistake is thinking PHP runs in the browser, like JavaScript. It cannot react to a click until a new request reaches the server.
Drills
Answer fast — trust the rule.
Where does PHP code execute?
A visitor opens View Source on a PHP page. What do they see?
Which release first brought the match expression and named arguments?
What is the smallest setup that lets you run PHP pages locally?
Remember
- PHP runs on the server, builds the page, and sends only the result.
- Shortcut: ask "what arrives at the browser?"
- Trap: PHP is not browser code, and advice written for PHP 5 may be out of date.
