// Learn
// Sandbox
// Reference
<?php
Beyond the basics
Advanced PHP features most developers never learned from books β generators, fibers, match expressions, named arguments, and the entire modern PHP 8.x world.
PHP
Output
php://stdout
PHP Quick Reference
// advanced Β· modern Β· PHP 8.x
| Feature | PHP Ver. | Rarity | Purpose |
|---|---|---|---|
match | 8.0 | Rare | Strict value matching expression (no fallthrough) |
| Named Arguments | 8.0 | Rare | Pass args by parameter name, skip optional ones |
Nullsafe Operator ?-> | 8.0 | Rare | Chain methods without null checks |
Union Types int|string | 8.0 | Rare | Multiple accepted types in one declaration |
| Constructor Promotion | 8.0 | Epic | Declare + assign properties in constructor params |
Attributes #[...] | 8.0 | Epic | Native annotations / metadata on classes & methods |
throw expression | 8.0 | Rare | Throw exceptions in expressions, not just statements |
| Fibers | 8.1 | Legend | Cooperative multitasking / async primitives |
| Enums | 8.1 | Epic | First-class enumeration types |
| Readonly Properties | 8.1 | Rare | Write-once property enforcement |
Intersection Types A&B | 8.1 | Epic | Value must satisfy multiple types simultaneously |
| First-class callables | 8.1 | Epic | strlen(...) as a closure reference |
| Readonly Classes | 8.2 | Rare | All properties readonly by default |
| DNF Types | 8.2 | Legend | Disjunctive Normal Form type expressions |
never return type | 8.1 | Epic | Function never returns (throws or exits) |
Generators yield | 5.5 | Epic | Lazy iterators β produce values one at a time |
yield from | 7.0 | Legend | Delegate to another generator or iterable |
Spread operator ... | 5.6 | Rare | Unpack arrays into function arguments |
| Named captures in regex | any | Epic | (?P<name>...) in preg functions |
array_is_list() | 8.1 | Rare | Check if array is a sequential list |
str_contains/starts/ends | 8.0 | Rare | Readable string search helpers |
fdiv() | 8.0 | Legend | IEEE 754 safe division returning INF/NAN instead of errors |
| WeakMap | 8.0 | Legend | Object-keyed map that doesn't prevent garbage collection |
| Splat in const expressions | 8.1 | Legend | Spread arrays in const initializers |
static return type | 8.0 | Epic | Return type that refers to the called class (fluent APIs) |
Closure bind / bindTo | 5.4 | Epic | Rebind closures to different objects/scopes |
compact() / extract() | any | Rare | Convert between variable names and arrays |
array_walk_recursive() | any | Rare | Apply callback to all nested array values |