title: Which of these techniques is best for performance and memory?
body: <p>I have to access a class from within several other classes. I am wondering if it is better to use 'global' or pass the class to the other classes.</p>
  
  <pre><code>$m_class = new SOmeClass();
  
  
  
  #1 -
  class AnotherClass{
  
     private $mClass;
     function __construct(){
  
        global $m_class;
        $this-&gt;mClass = $m_class;
     }
  }
  
  #2
  class AnotherClass{
  
       private $mClass;
       function __construct($mClassPassed){
  
            $this-&gt;mClass = $mClassPassed;
       }
  
  
  }
  </code></pre>