Named arguments pass values to a function by parameter name instead of position. This makes function calls easier to read and lets you skip optional parameters you do not need to change.
Named Arguments (PHP 8)
function createUser(
string $name,
int $age = 0,
string $role = "user",
bool $active = true
): void { /* ... */ }
// Old way — must pass in order
createUser("Alice", 0, "admin", true);
// Named arguments — any order, skip defaults
createUser(name: "Alice", role: "admin");
// Useful with built-in functions
array_slice(array: $items, offset: 2, length: 5);
str_contains(haystack: $text, needle: "PHP");
implode(separator: ", ", array: $list);