3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function test(int $a) { var_dump($a); } $d = [42, 146.1173, '987', '7string', null]; foreach($d as $v) { test($v); }
Output for 7.3.0alpha1 - 7.3.0rc3
int(42) int(146) int(987) Notice: A non well formed numeric value encountered in /in/Fh9NB on line 3 int(7) Fatal error: Uncaught TypeError: Argument 1 passed to test() must be of the type int, null given, called in /in/Fh9NB on line 10 and defined in /in/Fh9NB:3 Stack trace: #0 /in/Fh9NB(10): test(NULL) #1 {main} thrown in /in/Fh9NB on line 3
Process exited with code 255.
Output for 7.0.0 - 7.2.6
int(42) int(146) int(987) Notice: A non well formed numeric value encountered in /in/Fh9NB on line 3 int(7) Fatal error: Uncaught TypeError: Argument 1 passed to test() must be of the type integer, null given, called in /in/Fh9NB on line 10 and defined in /in/Fh9NB:3 Stack trace: #0 /in/Fh9NB(10): test(NULL) #1 {main} thrown in /in/Fh9NB on line 3
Process exited with code 255.
Output for hhvm-3.15.4
int(42) int(146) int(987) Notice: A non well formed numeric value encountered in /in/Fh9NB on line 5 int(7) Fatal error: Uncaught TypeError: Argument 1 passed to test() must be an instance of int, null given in /in/Fh9NB:5 Stack trace: #0 /in/Fh9NB(10): test() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Catchable fatal error: Argument 1 passed to test() must be an instance of int, integer given, called in /in/Fh9NB on line 10 and defined in /in/Fh9NB on line 3
Process exited with code 255.