title: PHP Notice: Undefined variable when including another file and getting variable from it in a function
body: <p>I have the following two files, first is for config options, and the second contains some functions. When I try to get the variable from <code>config.php</code> in <code>functions.php</code> then I get error:</p>
  
  <blockquote>
    <p>Notice: Undefined variable: config in /var/www/app/functions.php on line 15</p>
  </blockquote>
  
  <p>Config in file config.php</p>
  
  <pre><code>$config = array('page_title' =&gt; 'Page Title');
  </code></pre>
  
  <p>File functions.php</p>
  
  <pre><code>require_once 'config.php';
  
  function get_header() {
    $header = new Template( 'header' );
    $header-&gt;set( 'pagetitle', $config['page_title'] );
    echo $header-&gt;output();
  }
  </code></pre>
  
  <p>When I tried to place the config variable inside the function it works correctly. Why I can do this my way?</p>