Amanite Laurine Amanite Laurine - 3 months ago 6
PHP Question

can't execute function returned in variable php

I have a function with this syntaxe :

$variable = function() {
return function(){
//code
}
}


I can't execute that function with

$variable()


Is there a way to execute this function ?

Answer

I don't know for what is it... But here example:

$a = function () {
   return function () { 
       return 1; 
   };
};
$b = $a();
echo $b();