3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A {} class B extends A {} class Handler { public function handle(A $a) { print get_class($a); } } class HandlerB extends Handler { public function handle($a) { print get_class($a); } } $handlerA = new Handler(); $handlerB = new HandlerB(); $handlerA->handle(new A()); $handlerB->handle(new B());
based on SSh18
Output for 7.2.0 - 7.3.0rc3
AB
Output for 7.0.28 - 7.1.23
Warning: Declaration of HandlerB::handle($a) should be compatible with Handler::handle(A $a) in /in/2VP0D on line 17 AB
Output for 5.6.38
Strict Standards: Declaration of HandlerB::handle() should be compatible with Handler::handle(A $a) in /in/2VP0D on line 17 AB