3v4l.org

run code in 300+ PHP versions simultaneously
<?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

preferences:
42.16 ms | 402 KiB | 5 Q