Example
function a(){
$num = 1;
function b(){
echo $num; // how to get $num value?
}
}
In this case global
not working, because $num
isn't global variable.
Example
function a(){
$num = 1;
function b(){
echo $num; // how to get $num value?
}
}
In this case global
not working, because $num
isn't global variable.
function a() {
$num = 1;
function b($num) {
echo $num;
};
b($num);
}
a();
You could use the S_SESSION to get the variable?
function a(){
$_SESSION['num'] = 1;
function b(){
echo $_SESSION['num'];
}
}
Not sure nested function is the way to go btw.