Returning a variable that is deeply nested in an if else control structure?
<p>How would I return a variable that is deeply nested inside an if else structure, for use in another function that alters the program flow from the result of the returned variable in the first function?
This is the basic structure of the program, the if and else statements can contain more if else statements that is why I used the word deeply. How would I use the variable in the second function?</p>

<p>e.g.</p>

<pre><code>function this_controls_function_2($flow) {
    if($flow == 1) {
       $dothis = 1;
       return $dothis;
    }
    else {
       $dothis = 2;
       return $dothis;
    }
}

function this_is_function_2() {
    if($dothis == 1) {
       //DO SOMETHING
    }
    else {
       //DO SOMETHING
    }
} 
</code></pre>
