A static property (trvar) can only be accessed using the classname (C1). But a static function (stfunc) can be accessed using the classname or the instance ($obj).
trait Counter {
    static $trvar=1;

    public static function stfunc() {
        echo "Hello world!"
    }
}
class C1 {
    use Counter;
}
print "\nTRVAR: " . C1::$trvar . "\n";   //prints 1

$obj = new C1();
C1::stfunc();   //prints  Hello world!
$obj->stfunc();   //prints Hello world!
by გიორგი უზნაძე
4 years ago
PHP
OOP
Traits
0
Pro tip: use ```triple backticks around text``` to write in code fences