3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function myadd(int $a, int $b) { return $a + $b; } echo myadd(6.5, 7);
based on F5oq5
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to myadd() must be of the type integer, float given, called in /in/ntXdv on line 8 and defined in /in/ntXdv:4 Stack trace: #0 /in/ntXdv(8): myadd(6.5, 7) #1 {main} thrown in /in/ntXdv on line 4
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/ntXdv on line 2 Catchable fatal error: Argument 1 passed to myadd() must be an instance of int, double given, called in /in/ntXdv on line 8 and defined in /in/ntXdv on line 4
Process exited with code 255.