PHP_logo

Anonymous functions function() use ()

Anonymous functions in PHP may use this expression: function($parameter) use ($value) { } What does it means? This function, simply use a reference to the variable $value that then returns to the parent scope. For example: $value = 5; $customFunction = function($parameter) use ($value) { $value = $value + $parameter; } call_user_func ( $customFunction, 2[…]