3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php interface RegularInterface {} interface BetterInterface extends RegularInterface {} class Thing implements BetterInterface { } class RegularClass { public static function doSomething(RegularInterface $thing) { echo 'hello'; } } class BetterClass extends RegularClass { public static function doSomething(BetterInterface $thing) { echo 'hello'; } } $thing = new Thing(); BetterClass::doSomething($thing);
Output for 7.0.0 - 7.1.0
Warning: Declaration of BetterClass::doSomething(BetterInterface $thing) should be compatible with RegularClass::doSomething(RegularInterface $thing) in /in/b79hn on line 19 hello
Output for hhvm-3.10.0 - 3.13.2
hello
Output for 5.4.0 - 5.6.28
Strict Standards: Declaration of BetterClass::doSomething() should be compatible with RegularClass::doSomething(RegularInterface $thing) in /in/b79hn on line 19 hello
Output for 5.0.0 - 5.3.29
Strict Standards: Declaration of BetterClass::doSomething() should be compatible with that of RegularClass::doSomething() in /in/b79hn on line 19 hello
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_STRING in /in/b79hn on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_STRING in /in/b79hn on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/b79hn on line 3
Process exited with code 255.