3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A { public function f() { return false; } } $a = new A(); function f(A $a = null) { if ($a->f()) { echo 1; } else { echo 0; } } f(5);
based on Ahpvq
Output for 7.1.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to f() must be an instance of A or null, integer given, called in /in/XqR6C on line 20 and defined in /in/XqR6C:11 Stack trace: #0 /in/XqR6C(20): f(5) #1 {main} thrown in /in/XqR6C on line 11
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: Argument 1 passed to f() must be an instance of A, integer given, called in /in/XqR6C on line 20 and defined in /in/XqR6C:11 Stack trace: #0 /in/XqR6C(20): f(5) #1 {main} thrown in /in/XqR6C on line 11
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Catchable fatal error: Argument 1 passed to f() must be an instance of A, integer given, called in /in/XqR6C on line 20 and defined in /in/XqR6C on line 11
Process exited with code 255.