I'm trying to get this registry code to work!!

Its basically loads classes when they are needed, However the error and render class both depend on each other and I have put the code in an infiniate loop.

This isn't the full code, just a sample I have knocked together.

I'm not sure how to handle this type of situation. Thanks

PHP Code:
<?php

    
class Loader
    
{
         private 
$instances = array();

        public static function &
getInstance()
        {
            static 
$me;
            if (
is_object($me) == false) {
                
$me = new Loader;
            }
            return 
$me;
        }
    
        public function &
load($class)
        {
            
// check if class loaded if not load it
            
if (!array_key_exists($class$this->instances)) {
                
$this->instances[$class] = new $class;
            }
            return 
$this->instances[$class];
        }
    }

    class 
Render
    
{
         private 
$error;

        public function 
__construct()
        {
            
$loader      =& Loader::getInstance();
            
$this->error $loader->load('Error');
        }
        public function 
display($contents)
        {
            echo 
$contents;
        }
    }
    
    class 
Error
    
{
         private 
$render;

        public function 
__construct()
        {
            
$loader        =& Loader::getInstance();
            
$this->render $loader->load('Render');
        }
        public function 
show404($message)
        {
            
$this->render->display("404");
        } 
    }
    
    class 
Application
    
{
         private 
$error;

        public function 
__construct()
        {
            
$loader       =& Loader::getInstance();
            
$this->render $loader->load('Render');

            
$this->render->display("application");
        }
    }

    
$app = new Application;

?>