title: PHP - Undefined variable config?
body: <p>So I have a config file, config_inc.php:</p>
  
  <pre><code>&lt;?php
  static $config = Array();
  $config['dbHost'] = 'localhost';
  $config['dbPass'] = '';
  $config['dbUser'] = 'root';
  $config['dbName'] = 'recipes_comments';
  ?&gt;
  </code></pre>
  
  <p>And then I have a controller which is supposed to load these variables using require_once:</p>
  
  <pre><code>require_once "config_inc.php";
  class Controller {
  public function regUser() {
  echo $config['dbHost'];
  }
  }
  </code></pre>
  
  <p>I tried to find posts with similar errors, but could not find one that provides a solution that fixes this.</p>
  
  <p>When I try to echo a variable defined in config_inc.php as shown above, I get an error that config is undefined.</p>
  
  <p><strong>My question: Why is config not defined in Controller and what's the proper way to do this?</strong></p>