title: Accessing class through $variable within another class?
body: <p>I have a few classes, initiated on index.php, like so:</p>
  
  <pre><code>&lt;?php
  require_once('./classes/core.class.php');
  require_once('./classes/forum.class.php');
  $core = new core();
  $forum = new forum();
  ?&gt;
  </code></pre>
  
  <p>Is there any way to use $core within $forum? I can do it by using <code>core::functionName()</code> but not by <code>$core-&gt;functionName()</code>.</p>
  
  <p>The classes are:</p>
  
  <pre><code>&lt;?php
  class forum{
      public function functionName(){
  </code></pre>
  
  <p>I can access it by defining the class again within each function</p>
  
  <pre><code>public function functionName(){
      $core = new core();
  </code></pre>
  
  <p>Thanks in advance</p>