title: Make all global variables available in a function
body: <p>My project uses a template system to put the pages together and there are many variables involved. Usually the template is loaded directly from an index file and not from within a function.</p>
  
  <p>However, at the moment I'm simply making this function to display an error page:</p>
  
  <pre><code>function show_error($error){
      global $root;
      global $template;
      $content=$root."/includes/pages/error_page.html.php";
      include $root . $template;
      exit();
  }
  </code></pre>
  
  <p>However, since the template uses many variables outside the scope of this function, it just comes up with lots of variable not found errors.</p>
  
  <p>Is there a way of simply making all global variables available inside of a function? I'd rather not individually declare all possible variables inside as it would be quite tedious and because I am often adding more variables in the template.</p>