Intermediate
PHP
Q42 / 100
What is a PHP closure?
Correct! Well done.
Incorrect.
The correct answer is B) An anonymous function that can capture variables from the surrounding scope using use
B
Correct Answer
An anonymous function that can capture variables from the surrounding scope using use
Explanation
$fn = function($x) use ($factor) { return $x * $factor; }; captures $factor by value. use (&$var) captures by reference.
Progress
42/100