3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function add(int $a, int $b) { return $a + $b; } echo(add("ahoj", 5));
based on 9qoKC
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to add() must be of the type integer, string given, called in /in/6bRJE on line 6 and defined in /in/6bRJE:3 Stack trace: #0 /in/6bRJE(6): add('ahoj', 5) #1 {main} thrown in /in/6bRJE on line 3
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Catchable fatal error: Argument 1 passed to add() must be an instance of int, string given, called in /in/6bRJE on line 6 and defined in /in/6bRJE on line 3
Process exited with code 255.