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
Post a Comment