How to properly use global variables inside of class methods
<p>Currently I am re-vamping some code that I currently have written something like this:</p>

<pre><code>&lt;?php
global $foo;
$foo = "foo";

class foo{
   function bar(){
      global $foo;
      return $foo."bar";
   }
}

$class = new foo();
echo foo-&gt;bar();
//returns 'foobar';
?&gt;
</code></pre>

<p>This works, just fine. My question is, is this the correct way to include the variables? Some of my class files have upwards of 20 global variables, that have to be redefined as global in every method that they are used in.</p>
