This question already has an answer here:
- Accessing a variable defined in a parent function 5 answers
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.