3v4l.org

run code in 300+ PHP versions simultaneously
<?php trait T { public function x() { print "x"; } private function y() { print "y"; } } class C { use T { x as private; y as public; }; } $c = new C(); $c->x(); $c->y();
Output for 7.1.0 - 7.1.6
Parse error: syntax error, unexpected ';', expecting function (T_FUNCTION) or const (T_CONST) in /in/lVV65 on line 12
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Parse error: syntax error, unexpected ';', expecting function (T_FUNCTION) in /in/lVV65 on line 12
Process exited with code 255.

preferences:
177.63 ms | 1399 KiB | 35 Q