How to access dynamic global information in a static function
<p>I'm setting some global configuration variables in the following manner:</p>

<pre><code>$yaml = file_exists('config.yml') ? Spyc::YAMLLoad('config.yml') : array();

$defaults = array(
  'hostname' =&gt; 'localhost',
  'base_uri' =&gt; '/wag/'
);

$config = array_merge($default, $yaml);
</code></pre>

<p>Now I'd like to define a function <code>base_url($https)</code> that returns a base URL. The method body might just be:</p>

<pre><code>return 'http' . ($https ? 's' : '') . '//' . $config['hostname'] . $config['base_uri'];
</code></pre>

<p>But I don't know how to access those default variables after they have been created. How would I go about doing so. I'd also be open to finding another way to achieve the end goal I'm looking for (having a configuration variable/constant as well as some utility functions to help me synthesize values based on that configuration data).</p>
