Intermediate PHP
Q88 / 100

What is PHP's first class callable syntax (PHP 8.1)?

Correct! Well done.

Incorrect.

The correct answer is B) Closure::fromCallable($fn) as a shorthand: $fn = strlen(...) creates a closure from a function

B

Correct Answer

Closure::fromCallable($fn) as a shorthand: $fn = strlen(...) creates a closure from a function

Explanation

$fn = strlen(...) is equivalent to Closure::fromCallable("strlen"). Works for functions, methods, static methods: $fn = $obj->method(...).

Progress
88/100