3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); class A { public function foo() { return 'bar'; } } class B extends A { public function foo(): string { return 'derp'; } } $b = new B(); echo $b->foo();
based on KcPvG
Output for hhvm-3.15.4, 7.0.0 - 7.2.6
derp
Output for 5.6.0 - 5.6.30
Warning: Unsupported declare 'strict_types' in /in/QP4F6 on line 2 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/QP4F6 on line 11
Process exited with code 255.