<?php
class A {
public static function getStuff() {
return self::myStuff();
}
protected static function myStuff() {
return "A::myStuff";
}
}
class B extends A {
protected static function myStuff() {
return "B::myStuff";
}
}
echo "### self::... (static call)\n";
var_dump(A::getStuff());
var_dump(B::getStuff());
class A2 {
public static function getStuff() {
return static::myStuff();
}
protected static function myStuff() {
return "A::myStuff";
}
}
class B2 extends A2 {
protected static function myStuff() {
return "B::myStuff";
}
}
echo "\n### static::... (dynamic call)\n";
var_dump(A2::getStuff());
var_dump(B2::getStuff());