Variables in Classes
<p>I stumbled across a very wired error in php:</p>

<pre><code>class A {
     public $var = "test";
     public function __construct() {
        $this-&gt;var = "test2";
        $b = new B;
        $b-&gt;method();
    }
}

class B extends A {
    public function method() {
        $c = new C;
        $c-&gt;method();
    }
}

class C extends B {
    public function method() {
        echo $this-&gt;var;
    }
}

$a = new A;
</code></pre>

<p>I get the output "test", but I do not know why, cause the variable var should be overwritten in Class A.</p>

<p>If I output $var in Class A it says "test2", if I output it in Class B it says "test"…</p>
