Original question
Since anonymous functions are added in the latest php version, is there any way to extend the functions? in javascript i would do:
var temp = immaFunction;
immaFunction = function(){
temp.apply(this, arguments);
}
Result
Starting with 5.3, PHP has anonymous first-class functions.
However, a few points to keep in mind (will fill it up more when I argue with him.):
- You must import any external variables that you want to use. (Example 1)
Examples
Example 1:
$foo = "bar";
$fooBar = function() use ($foo){
echo $foo;
}
$fooBar();
source
share