Using Variables outside a function
I am trying to create function that will assign several variables during it's process, but I cannot seem to get those variables to display outside of the function.
function example ($input_var) {
if ($input_var == option1) {
$new_var = new_desired_output1;
}
else {
$new_var = new_desired_output2;
}
}
Then I define $input_var and have a call to the function in the page:
$input_var = some_var;
example ($input_var);
Then later in the page:
echo $new_var;
But the last bit does not work?
Is there a trick to get the new variable out of the function? I can get it to work inside the function, but not outside??
Thanks
__________________
Rob
|