First Class Callable

In PHP 8.1, a new feature called ‘First Class Callable Syntax’ was introduced. It allows to create a closure directly, by usingthe triple dot operator as an argument.

Such closure may be created using any kind of function, such as native PHP function, or library methods.

<?php

$a = foo(...);

$function = strtolower(...);

?>

Documentation

See also PHP’s First-Class Callable Syntax

Related : Functions, Closure, Anonymous Function, Arrow Functions, Arrow Functions, Closure

Added in PHP 8.1