So I have two classes like this:
class foo { /* code here */ } $foo = new foo(); class bar { global $foo; public function bar () { echo $
Make it a member of bar. Try to never use globals.
class bar { private $foo; public function __construct($foo) { $this->foo = $foo; } public function barMethod() { echo $this->foo->something(); } }