} public function modifyPrivate() { $this->copy->t = 'modified string'; } } $name = 't'; $cl = new $name(); $c = new T(); $c1 = new $c(); $c2 = T::getNew(); $c3 = TT::getNew(); var_dump(get_class($c3)); // TT, because of "static". would be T, if it were "return new self" var_dump(TT::$hello); var_dump(TT::getParentHello()); var_dump(T::HELLO); var_dump(TT::HELLO); TT::getHelloConst(); // Notice: undefined var_dump($c->ewfiohoiwefh); // null //throw new Exception(); destructors won't run // fatal //var_dump((new T())->$hello); // works var_dump($c::$hello); var_dump($c3::$hello); // works (new T())->getHelloConst(); var_dump(TT::testConst());