要点
self: 定義時のクラスを指す
static: 実行時のクラスを指す
例
class Foo
{
public function helloGateway()
{
self::hello();
}
public static function hello()
{
echo __CLASS__ . 'hello' . PHP_EOL;
}
}
class Bar extends Foo {
public static function hello()
{
echo __CLASS__ . 'hello' . PHP_EOL;
}
}
$bar = new Bar();
echo $bar->helloGateway();
//この場合はFoohelloが出力される