haphpiness

These are things in PHP which make me genuinely_happy();

PHP 8 Named Arguments

Before PHP 8, calling a function with many optional parameters meant counting commas and passing null for every parameter you didn't care about. Named arguments eliminated this entirely.

// Before: Which argument is which? Good luck.
htmlspecialchars($string, ENT_COMPAT | ENT_HTML401, 'UTF-8', false);

// After: Crystal clear intent.
htmlspecialchars($string, double_encode: false);

Named arguments aren't just syntactic sugar — they're self-documenting code. When you read double_encode: false, you know exactly what's happening without checking the docs. They also let you skip optional parameters entirely, calling only what matters.

Combined with phparray_slice and other functions that have many optional parameters, named arguments turn frustrating API calls into readable, maintainable code.

Significance: Readability

Code is read far more often than it is written. Named arguments make function calls self-documenting, reducing the cognitive load of understanding existing code and eliminating an entire class of positional bugs.