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([]]); // => (int) 1 my_func(NULL); // => Fatal error: Uncaught TypeError: Argument 1 passed to my_func() must be of the type integer, null given.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.7
Parse error: syntax error, unexpected ']', expecting ',' or ')' in /in/54rA5 on line 7
Process exited with code 255.

preferences:
167.99 ms | 1395 KiB | 36 Q