title: How to make a globally accessible object
body: <p>Hi i have a little collection of classes some of which should be globally accessible.</p>
  
  <p>I found something similar in Zend_Registry, but reading its code i cant understand how a call to a static function could return an initialized instance of a class...</p>
  
  <p>i need to do something like:</p>
  
  <pre><code>&lt;?php
  //index.php
  $obj = new myUsefulObject();
  $obj-&gt;loadCfg("myFile.xml");
  $req = new HTTPRequest();
  $req-&gt;filter("blablabla");
  myappp::registerClass("object",$obj);
  myappp::registerClass("request",$req);
  $c = new Controller();
  $c-&gt;execute();
  ?&gt;
  </code></pre>
  
  <p>Here i have filtered the Request object and i want the controller to be able to reach that already filtered request.</p>
  
  <pre><code>&lt;?php
  class Controller
  {
      function __construct()
      {
          $this-&gt;request = Application::getResource("request");//This must be the filtered var =(
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>I don't know how to implement that Application::getResource(), the only thing i know is that it must be a static method because it can't be related to a specific instance.</p>