title: PHP - accessing global variables in all functions of class
body: <p>I need to access some variables of an external php file in most of functions of a class. I'm accessing in following way (and it works fine)</p>
  
  <pre><code>class test{
  
  function a(){ 
      global $myglobalvar ;
      ..
      ..
      }
  
  function b(){ 
      global $myglobalvar ;
      ..
      ..
      }
  
  function c(){ 
      global $myglobalvar ;
      ..
      ..
      }
  
  }
  </code></pre>
  
  <p>Is there a way that i can access $myglobalvar in all functions of the class without declaring in each function? I did read that it can be done by declaring only once in the constructor of the class, but I dont know how to do it. 
  Thanks for any help.</p>