PHP 8.4 & 8.5 — Hands-on Workshop May 7, 2026
Welcome! Tonight we're going to play with four of the tastiest new features from PHP 8.4 and 8.5, split across four exercises.
Structure: short intro → you try it → we move on. No prior 8.4/8.5 knowledge required — if you've written a class in PHP, you're ready.
🚀 Get your environment ready (pick one)
You need a way to run PHP 8.5. Easiest options first.
1. 3v4l.org (browser, zero install)
Open 3v4l.org, paste your code, hit Eval. It runs against every PHP version at once — scroll to the PHP 8.5.x line to see the output.
Tip: add <?php at the top, otherwise 3v4l assumes HTML.
2. Docker one-liner
One terminal, no install polluting your system:
docker run --rm -it -v "$PWD":/app -w /app \
php:8.5-cli php hero.php
Or an interactive REPL:
docker run --rm -it php:8.5-cli php -a
3. DDEV (if you already use it)
Edit .ddev/config.yaml:
php_version: "8.5"
Then ddev restart and ddev php hero.php.
4. Local install
macOS: brew install php@8.5
Linux (Ubuntu): sudo add-apt-repository ppa:ondrej/php then sudo apt install php8.5-cli
Windows: WSL + the Docker option, or grab the binary from windows.php.net.
php -v and make sure you see PHP 8.5.x. If you see 8.4, most of exercise 1 will work but exercise 2 and 3 will not.
📋 Exercises
🗡️ Forge Your Hero
Modernise a character sheet class using property hooks and asymmetric visibility.
🥞 The Pancake Builder
Build an immutable pancake order using the pipe operator and clone-with.
|>
🎵 Festival Lineup
Query a festival lineup using six brand-new array functions across PHP 8.4 and 8.5.
🏷️ PHP Attributes
Replace docblock annotations with real PHP attributes — and use Reflection to read them at runtime.
📚 Going further
Official release notes
Specific RFCs we used
Playground
- 3v4l.org — run code against every PHP version
- onlinephp.io — another browser sandbox