Variables loaded from a separate script are not defined within functions
<p>I use  settings.php  to store general settings for my application. When I load this settings file, I can use the variables defined in settings.php in the script itself, but not within any functions I define in it. </p>

<p>For example, in my class definition, myclass.php: </p>

<pre><code>&lt;?php 
$preIP = dirname(__FILE__);
require_once( "preIP/settings.php" );

class MyClass {
  ...
  public function foo() {
    echo $variable_from_settings;
  }
}
</code></pre>

<p>The code in the function foo() will not work (the variable will not be defined).</p>

<p>The settings.php file looks like this:</p>

<pre><code>$variable_from_settings = "bar";
</code></pre>

<p>Thanks,</p>
