3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); 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([]); // => Fatal error: Uncaught TypeError: Argument 1 passed to my_func() must be of the type integer, array given my_func(new \stdClass()); // => ... object given my_func(NULL); // => ... null given

preferences:
23.5 ms | 402 KiB | 5 Q