Master the most impactful PHP 8.0–8.3 features: match expressions, named arguments, nullsafe operator (?->), union and intersection types, readonly properties, enums with methods and interfaces, fibers for cooperative multitasking, and first-class callable syntax.
Background
PHP 8.0 (2020) was the biggest leap since PHP 7. Each new feature reduces boilerplate and improves correctness. match is a strict switch replacement. Named arguments enable skipping defaults without wrapping in arrays. readonly enforces immutability. Enums replace class-based constants with a type-safe, first-class construct. Fibers (8.1) bring low-level coroutine support — the foundation of async frameworks like ReactPHP and Revolt.
Time
30 minutes
Prerequisites
PHP Foundations Lab 14 (Type System)
Tools
Docker: zchencow/innozverse-php:latest (PHP 8.3)
Lab Instructions
Step 1: match, named arguments, nullsafe
📸 Verified Output:
Step 2: Readonly properties, enums with methods, intersection types