<?php
class A {
const X = 'A';
public function x() {
echo static::X;
}
}
class B {
public static $X = 'B';
public function x() {
echo self::$X;
}
public function x2() {
echo B::$X;
}
}
class C extends A {
const X = 'C';
}
$c = new C();
$c->x();
echo C::X;
echo c::X;
$b = new B();
$b->x();
$b->x2();
echo b::$X;
echo B::$X;
//https://pt.stackoverflow.com/q/242625/101
PD9waHAKCmNsYXNzIEEgewogICAgY29uc3QgWCA9ICdBJzsKICAgIHB1YmxpYyBmdW5jdGlvbiB4KCkgewogICAgICAgIGVjaG8gc3RhdGljOjpYOwogICAgfQp9CgpjbGFzcyBCIHsKICAgIHB1YmxpYyBzdGF0aWMgJFggPSAnQic7CiAgICBwdWJsaWMgZnVuY3Rpb24geCgpIHsKICAgICAgICBlY2hvIHNlbGY6OiRYOwogICAgfQogICAgcHVibGljIGZ1bmN0aW9uIHgyKCkgewogICAgICAgIGVjaG8gQjo6JFg7CiAgICB9Cn0KCmNsYXNzIEMgZXh0ZW5kcyBBIHsKICAgIGNvbnN0IFggPSAnQyc7Cn0KCiRjID0gbmV3IEMoKTsKJGMtPngoKTsKZWNobyBDOjpYOwplY2hvIGM6Olg7CiRiID0gbmV3IEIoKTsKJGItPngoKTsKJGItPngyKCk7CmVjaG8gYjo6JFg7CmVjaG8gQjo6JFg7CgovL2h0dHBzOi8vcHQuc3RhY2tvdmVyZmxvdy5jb20vcS8yNDI2MjUvMTAx