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) . PHP_EOL; } } class HandlerB extends Handler { public function handle($a) { print get_class($a) . PHP_EOL; } } $handlerA = new Handler(); $handlerB = new HandlerB(); $handlerA->handle(new A()); $handlerB->handle(new B());
based on 2VP0D
Output for 7.2.0 - 7.3.0rc3
A B
Output for 7.0.28 - 7.1.23
Warning: Declaration of HandlerB::handle($a) should be compatible with Handler::handle(A $a) in /in/VL71l on line 17 A B
Output for 5.6.38
Strict Standards: Declaration of HandlerB::handle() should be compatible with Handler::handle(A $a) in /in/VL71l on line 17 A B