3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function my_func(int $n) { var_dump($n); } my_func('6'); // => (int) 6 my_func(3.1415); // => (int) 3 my_func(TRUE); // => (int) 1 my_func(new \stdClass()); // => Fatal error: Uncaught TypeError: Argument 1 passed to my_func() must be of the type integer, array given my_func([]); // => Fatal error: Uncaught TypeError: Argument 1 passed to my_func() must be of the type integer, array given my_func(NULL); // => ... null given
based on 2KKRv
Output for 7.3.0alpha1 - 7.3.0rc3
int(6) int(3) int(1) Fatal error: Uncaught TypeError: Argument 1 passed to my_func() must be of the type int, object given, called in /in/IjpG3 on line 7 and defined in /in/IjpG3:2 Stack trace: #0 /in/IjpG3(7): my_func(Object(stdClass)) #1 {main} thrown in /in/IjpG3 on line 2
Process exited with code 255.
Output for 7.0.0 - 7.2.6
int(6) int(3) int(1) Fatal error: Uncaught TypeError: Argument 1 passed to my_func() must be of the type integer, object given, called in /in/IjpG3 on line 7 and defined in /in/IjpG3:2 Stack trace: #0 /in/IjpG3(7): my_func(Object(stdClass)) #1 {main} thrown in /in/IjpG3 on line 2
Process exited with code 255.
Output for hhvm-3.15.4
int(6) int(3) int(1) Fatal error: Uncaught TypeError: Argument 1 passed to my_func() must be an instance of int, stdClass given in /in/IjpG3:2 Stack trace: #0 /in/IjpG3(7): my_func() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Catchable fatal error: Argument 1 passed to my_func() must be an instance of int, string given, called in /in/IjpG3 on line 4 and defined in /in/IjpG3 on line 2
Process exited with code 255.