3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait T { private function getId() { return 'trait'; } } class C{ use T; public function get() { return $this->getId(); } } $c = new C; echo $c->get(); echo $c->getId();
based on OP9vV
Output for 7.0.0 - 7.2.0
trait Fatal error: Uncaught Error: Call to private method C::getId() from context '' in /in/cDD8M:23 Stack trace: #0 {main} thrown in /in/cDD8M on line 23
Process exited with code 255.
Output for 5.4.0 - 5.6.21
trait Fatal error: Call to private method C::getId() from context '' in /in/cDD8M on line 23
Process exited with code 255.
Output for 5.3.19 - 5.3.29
Parse error: syntax error, unexpected T_STRING in /in/cDD8M on line 3
Process exited with code 255.