In PHP, two classes calling one another, how to avoid recursive calls?
<p>I have two classes, each needs the other to function correctly.
Whats the best way to code it (global instance?) since this will obviously not work:</p>

<pre><code>class A {
    function A() {
        $b = new B();
        $b-&gt;doSomething();
    }
    ...
}
class B {
    function b() {
        $a = new A();
        $a-&gt;doSomething();
    }
    ...
}
</code></pre>
