Original Question
Php yeni versiyonu anonim fonksiyonlar ekledi yana, işlevlerini genişletmek için bir yol var? Javascript yaparım:
var temp = immaFunction;
immaFunction = function(){
//do some random stuff
temp.apply(this, arguments);
}
Result
As of 5.3, PHP has first class anonymous functions.
A few points to consider however(will be filling this with more as I mess around with it.):
- Kullanmak istediğiniz herhangi bir dış değişkenleri almanız gerekir. (Örnek 1)
Examples
Örnek 1:
$foo = "bar";
$fooBar = function() use ($foo){
echo $foo;
}
$fooBar(); //bar