3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class weasel { } function show1(int $value) { var_dump($value); } function show2(weasel $value) { var_dump($value); } try { show1(new weasel()); } catch (throwable $e) { echo $e->getMessage(), "\n"; } try { show2(10); } catch (throwable $e) { echo $e->getMessage(), "\n"; }
based on kE3hC
Output for 7.0.0 - 7.2.0
Argument 1 passed to show1() must be of the type integer, object given, called in /in/HgpGj on line 15 Argument 1 passed to show2() must be an instance of weasel, integer given, called in /in/HgpGj on line 20
Output for 5.3.19 - 5.6.28
Catchable fatal error: Argument 1 passed to show1() must be an instance of int, instance of weasel given, called in /in/HgpGj on line 15 and defined in /in/HgpGj on line 6
Process exited with code 255.