Please correct my code, Global scope not working in my code

Viewed 15
function_one($parm, function(){

  $variable = 100;

  foreach($parm as $p){

     echo $variable; // Output is 100

     function_one($parm2, function(){
        
         global $variable;
         echo $variable; // No output, Why?
     });


   

};
})

I am trying to access $variable from inner function using global but it isnt working.

0 Answers
Related