title: Access Sibling Class Method
body: <p>I'm working on a basic MVC for practice, but I get this error:</p>
  
  <p><code>Fatal error: Call to a member function run() on a non-object in Router.php on line 5</code></p>
  
  <p>What am I doing wrong?</p>
  
  <p><b>Core:</b></p>
  
  <pre><code>&lt;?php
  
  class Core {
      protected $router;
      protected $controller;
  
      public function run() {
          $this-&gt;router =&amp; load_class('Router');
          $this-&gt;controller =&amp; load_class('Controller');
  
          $this-&gt;router-&gt;run();
      }
  }
  </code></pre>
  
  <p><b>Router:</b></p>
  
  <p>
  
  <pre><code>class Router extends Core {
      public function run() {
          echo $this-&gt;controller-&gt;run();
      }
  }
  </code></pre>
  
  <p><b>Controller:</b></p>
  
  <pre><code>class Controller extends Core {
      public function run() {
          return 'controller';
      }
  }
  </code></pre>
  
  <p><b>Oh, and the load_class function</b></p>
  
  <pre><code>function &amp;load_class($class_name) {
      $path = ROOT . 'system/classes/' . $class_name . '.php';
  
      if (file_exists($path)) {
          include_once($path);
  
          if (class_exists($class_name)) {
              $instance = new $class_name;
              return $instance;
          }
      }
  
      return false;
  }
  </code></pre>
  
  <p>Thanks so much in advance.</p>