PHP file includes inside function, need to retain global variables. (Trying to wrap HTML comments)
<p>In an attempt to speed up my workflow and help the back end guys with integration (I'm a front end dev) I'm attempting to extend the file includes function by wrapping comments around each file include to output it's filename:</p>

<pre><code>function include_module($path) {
    echo "\n\n&lt;!-- MODULE: ".basename($path, '.php')." --&gt;\n";
    include($path);
    echo "\n&lt;!-- /MODULE: ".basename($path, '.php')." --&gt;\n\n";
}   
include_module('form-controls.php');
</code></pre>

<p>However this results in the loss of access to any variables set outside the function. I know I can do:</p>

<pre><code>global $var
</code></pre>

<p>But that will only give me access to $var (I'm aware I could do $var['var1'], etc), is there any way to do 'global all' or can anyone think of a different approach to wrap the comments?</p>

<p>Cheers :)</p>
