title: Access global variable from within a class
body: <p>I have the following (stripped down) code:</p>
  
  <pre><code>&lt;?PHP
      class A {
          function Show(){
              echo "ciao";
          }
      }
  
      $a = new A();
      $b = new B();
  
      class B {
          function __construct() {
              $a-&gt;Show();
          }
      }
  ?&gt;
  </code></pre>
  
  <p>With a bit of surprise I cannot access the globally defined $a variable from within the class and I get a <em>Undefined variable</em> exception. Any help?</p>