Possible Duplicate:
PHP: Global variable scope
How can I set a variable outside a function from inside the function? Here is what I mean:
$myVar = false;
function myFunction($param1 $param2){
....
if($param1 == $x){
$myVar = $param1;
}
}
$myVar seems to always stay empty. How can I do this?
Thank you!
You create a new local variable called `myVar’.
If you would like to stick with your variable outside of the function, you can use the following code to get it working, but global variables are at least in my opinion not the best solution in general.