I have seen a lot of questions already asked about the use of variables in functions or outside functions, but somehow I can't make it work in my case.
I have a PHP-file that declares two variables, and then starts defining a function. I want to use the 2 variables and a couple of arguments that should be passed along to the function.
I saw the "use" command that is available on anonymous functions, but I don't think that is what I want as the function does multiple things, and not just return a value. How can I use the variables in my funtion without resorting to global?
For clarification, my code looks like this:
$var1 = 'variable 1';
$var2 = 'variable 2';
function MyFunction($arg1,$arg2,$arg3){
// use $var1 and $var2 along with the 3 arguments supplied
}