PHP 8.0 Features in PHP
From the PHP cheat sheet · PHP 8 Features · verified Jul 2026
PHP 8.0 Features
Major features introduced in PHP 8.0
php
// Named arguments
function createUser($name, $email, $role = 'user') {
// ...
}
createUser(email: 'john@example.com', name: 'John');
// Union types
function processValue(int|string $value): void {
// ...
}
// Match expression
$result = match($value) {
1, 2 => 'low',
3, 4, 5 => 'medium',
default => 'high'
};
// Nullsafe operator
$country = $user?->getAddress()?->getCountry();💡 Match expressions are safer than switch (no fall-through)
⚡ Nullsafe operator prevents null reference errors
📌 Constructor promotion reduces boilerplate significantly
🔥 JIT compilation dramatically improves CPU-intensive tasks