PHP: how to get variable from function in another function? -


this question has answer here:

example

function a(){     $num = 1;      function b(){         echo $num; // how $num value?     } } 

in case global not working, because $num isn't global variable.

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

Comments

Popular posts from this blog

How to logout from a login page in asp.net -

Stack level too deep error after upgrade to rails 3.2 and ruby 1.9.3 -