The code is here:
class A {
public static $property = 1;
public function test(){
echo self::$property;
}
}
class B extends A{
public static $property = 2;
}
$b = new B();
echo $b->test() . "\n";
Console log:
$:1
I know that the class B
has overwrite the static property.
What is the cause of this result?