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

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -