// Positional — must remember the order
array_slice($array, 0, 5, true);
// Named — self-documenting without checking the signature
array_slice(
array: $array,
offset: 0,
length: 5,
preserve_keys: true,
);
// Skip parameters that have defaults
function createUser(
string $name,
string $role = 'user',
bool $active = true
) {}
createUser(name: 'Alice', active: false); // role defaults to 'user'
A named argument cannot be passed before a positional one. Named arguments in variadic functions become an associative array.