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!