In this chapter
We'll learn how PHP versions are numbered, how long each one is looked after, what changed between old PHP and modern PHP 8, what's new in PHP 8.5, and the everyday workflow a PHP developer follows — so you can tell old code from modern code the moment you see it.
The Problem in Real Life
That evening, Mia searches "PHP booking form tutorial" and finds a page with hundreds of comments. She copies its code into a new file, exactly as written, and runs it.
One line comes back: Fatal error: Uncaught Error: Call to undefined function mysql_connect(). She checks every character. The code is exactly like the tutorial. She tries a second tutorial — that one fails on a different line.
Next morning she shows Marcus. He scrolls to the bottom of the tutorial page: "Posted in 2009." He smiles. "This code is older than your first phone. PHP has changed a lot since then — that function was removed years ago."
How am I supposed to know which code is old? It all just looks like PHP to me.
Mia
Old PHP vs. Modern PHP
Old tutorials everywhere
The web is full of PHP written 10 or 20 years ago. Some of it no longer runs at all.
Many versions
PHP 5, 7, 8.0 … 8.5 — each version added features, and some removed old ones.
Old versions stop getting fixes
A version that's no longer supported gets no security fixes — dangerous for a real website.
PHP Versions and Modern PHP
PHP keeps improving. Every year the people who build PHP release a new version with new features, faster code and fixes — and sometimes they remove things that were unsafe or badly designed. So "PHP" in 2009 and "PHP" today are like a 2009 phone and a phone from today: the same idea, but very different inside.
How versions are numbered: a version like 8.5.2 has three parts, and each part tells you something different:
- 8 — the major version: a big step. A new major version (like PHP 7 → PHP 8) can remove old features, so old code may stop working. This happens only every few years.
- 5 — the minor version: a new set of features. A new minor version comes out every year, in November (PHP 8.4 in November 2024, PHP 8.5 in November 2025). Old code almost always keeps working.
- 2 — the patch version: bug fixes and security fixes only, no new features. Patches come out every few weeks. You should always install the latest patch.
How long a version is looked after: each minor version (like 8.5) gets about two years of active support — bugs and security problems are fixed — and then about two more years of security fixes only. After that it reaches end of life: no more fixes at all, even for serious security holes. The table below shows where the versions stand as Mia starts at BookBay. That's why Marcus says: "Real websites run a supported version. No exceptions."
| Version | Released | Active support until | Security fixes until | Status |
|---|---|---|---|---|
| 8.5 | November 2025 | End of 2027 | End of 2029 | Newest — used in this course |
| 8.4 | November 2024 | End of 2026 | End of 2028 | Supported |
| 8.3 | November 2023 | Ended | End of 2027 | Security fixes only |
| 8.2 | December 2022 | Ended | End of 2026 | Security fixes only — ending soon |
| 8.1 and older | 2021 and before | Ended | Ended | End of life — don't use |
Dates from php.net's supported-versions page. Each new version also moves the oldest one to end of life.
Old PHP vs. modern PHP: the two code boxes below do the same job — read a customer's name, or use "guest" if there isn't one, and print a greeting. The old version needs a long isset() check and has no types (types say what kind of value something is: a number, some text…). The modern version is shorter, says exactly what it expects, and PHP itself checks it. You don't need to understand every symbol yet — Acts 02 to 05 teach each one. Just learn to notice the difference.
<?phpfunction greet($name) {return "Hello, " . $name;}$name = isset($_GET['name']) ? $_GET['name'] : 'guest';echo greet($name);
It still runs, but nothing says what kind of value $name should be.
<?phpdeclare(strict_types=1);function greet(string $name): string{return "Hello, {$name}";}echo greet($_GET['name'] ?? 'guest');
Shorter, and the types (string) tell PHP — and the next developer — exactly what's expected.
The big steps in PHP's history: PHP 5 (2004) added proper object-oriented programming, a way of organising code you'll learn in Act 11. There was no PHP 6 — that version was started, abandoned, and skipped. PHP 7 (2015) made PHP roughly twice as fast and added type declarations. PHP 8 (2020) brought a long list of modern features: named arguments, match, the nullsafe operator ?->, attributes and a JIT compiler (it turns busy code into machine code while it runs). Every 8.x version since then added more: enums in 8.1, readonly classes in 8.2, typed class constants in 8.3, property hooks in 8.4.
What's new in PHP 8.5: the version this course uses. Its best-known new feature is the pipe operator |>, which passes a value through a chain of functions from left to right, so code reads in the order it happens. PHP 8.5 also adds handy functions like array_first() and array_last(), a built-in URI extension for reading and building web addresses safely, a #[\NoDiscard] attribute that warns you when you ignore an important result, and full stack traces for fatal errors, which makes bugs easier to find. You'll use several of these later in the course.
Each |> passes the value on its left into the function on its right. Read it from left to right: take the name, remove extra spaces, make it upper-case.
<?php$name = " tom's barbershop ";$clean = $name |> trim(...) |> strtoupper(...);echo $clean; // TOM'S BARBERSHOPecho PHP_VERSION; // 8.5.x
How to spot old code: be careful with any tutorial that uses mysql_ functions (removed in PHP 7), has no types anywhere, or doesn't say which PHP version it's for. Check the date, and prefer the official manual at php.net, which marks every function with the versions it works in.
A PHP developer's everyday workflow: whatever version you use, the daily loop is the same. Write code in an editor. Run it on your own computer (the next chapters set this up). Check that it works — first by looking at the result, later with automatic tests (Act 21). Save each finished step with Git, a tool that records every change to your code. Then deploy it — copy it to the real server so customers can use it. Mia will repeat this loop hundreds of times before Launch Day.
A PHP developer's everyday loop
Write
code in an editor
Run
on your own computer
Check
look at the result; later, tests
Save
record the change with Git
Deploy
copy it to the real server
Key Takeaway
PHP changes every year. Major versions can break old code, minor versions add features, and patches fix bugs. Only supported versions get security fixes, so real projects use a modern, supported version — this course uses PHP 8.5 — and treat old tutorials with care.
Why This Matters
At BookBay, every piece of code Mia copies, every package she installs and every server she deploys to has a PHP version. When they don't match, things break in confusing ways — like the mysql_connect() error. Checking the version first saves hours of guessing.
Versions also matter for safety. A website on an end-of-life PHP version gets no security fixes, so a newly discovered hole stays open forever. Keeping PHP up to date is part of the job — Act 24 covers how to plan an upgrade.
"So the plan is PHP 8.5," Mia says. "How do I get it on my laptop?" Marcus opens a terminal on her screen. "Let's install it. Windows, Mac or Linux — it's a little different on each." That's the next chapter.
