title: How to pass Global variables to classes in PHP?
body: <p>How can I pass the global variables to the classes I want to use without declare them as GLOBAL in every method of the class ?</p>
  
  <p>example : </p>
  
  <pre><code>$admin = "admin_area";
  
  if($_POST['login']){
        $user = new Administrator;
        $user-&gt;auth($pass,$username);
      }
  </code></pre>
  
  <p>in the class Administrator I want the variable $admin be accessible in all methods of the class without doing this :</p>
  
  <pre><code>class Administrator{
  
     public function auth($pass,$user){
  
       global $admin;
       .....
  
    }
    public function logout(){
      global $admin;
  
      .....
  }
  
  } 
  </code></pre>