3v4l.org

run code in 200+ PHP versions simultaneously
<?php if(version_compare(PHP_VERSION, "5.4.0", ">=")) eval(' interface Baz { public function bad(); } trait Bar{ protected function bad(){} } class Foo implements Baz{ use Bar; } $test = new Foo(); var_dump($test instanceof Baz); ');
Output for 7.4.0
Fatal error: Access level to Foo::bad() must be public (as in class Baz) in /in/p303Q(3) : eval()'d code on line 8
Process exited with code 255.
Output for 7.0.20, 7.1.5 - 7.2.6
Fatal error: Access level to Foo::bad() must be public (as in class Baz) in /in/p303Q(3) : eval()'d code on line 11
Process exited with code 255.
Output for 7.0.6 - 7.0.14, 7.1.0
Fatal error: Access level to Foo::bad() must be public (as in class Baz) in /in/p303Q(20) : eval()'d code on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.5
Fatal error: Access level to Bar::bad() must be public (as in class Baz) in /in/p303Q(20) : eval()'d code on line 11
Process exited with code 255.
Output for 5.5.25 - 5.5.38, 5.6.9 - 5.6.28
Fatal error: Access level to Bar::bad() must be public (as in class Baz) in /in/p303Q(20) : eval()'d code on line 13
Process exited with code 255.
Output for 5.4.11 - 5.5.24, 5.6.0 - 5.6.8
bool(true)
Output for 5.4.0 - 5.4.10
Fatal error: Access level to Foo::bad() must be public (as in class Baz) in /in/p303Q(20) : eval()'d code on line 13
Process exited with code 255.
Output for 4.3.0 - 5.3.29