Interview frequency: …
Short answer
It converts any function or method directly into a Closure object with (...) without passing unsafe strings or arrays.
Explanation
Previously, passing a method as a callback required an array or string, such as [$this, 'handleMethod'] or 'strlen'. PHP 8.1 added First-Class Callable syntax: strlen(...) or $this->handleMethod(...). The engine immediately creates a Closure and checks that the function exists and is valid, while also supporting IDE autocomplete.
Code example
$numbers = ["10", "20", "30"];
// Modern syntax
$integers = array_map(intval(...), $numbers);Common mistakes
- Using legacy function-name strings in modern applications, preventing static analysis tools from catching typos.