3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php trait T { public function x() { print "x"; } private function y() { print "y"; } } class C { use T; } $c = new C(); $c->x(); $c->y();
based on aD7aJ
Output for 7.0.0 - 7.3.0rc3
x Fatal error: Uncaught Error: Call to private method C::y() from context '' in /in/dgqdl:14 Stack trace: #0 {main} thrown in /in/dgqdl on line 14
Process exited with code 255.
Output for hhvm-3.15.4
x Fatal error: Uncaught Error: Call to private C::y() from invalid context in /in/dgqdl:14 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
x Fatal error: Call to private method C::y() from context '' in /in/dgqdl on line 14
Process exited with code 255.