By default, when you are inside a function, you do not have access to the outer variables.
If you want your function to have access to an outer variable, you have to declare it as global, inside the function
1 2 3 4 5 6 7 8 |
$myval = "hi"; function myfunction(){ global $myval; echo $myval; } |