3v4l.org

run code in 300+ PHP versions simultaneously
<?php function bar(?int $i = null) { var_dump($i); if (intval($i)) { foo($i); } else { foo(); } } function foo(int $i = 42) { echo "foo got $i\n"; } bar(1); bar();
Output for 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1
int(1) foo got 1 NULL foo got 42

preferences:
54.5 ms | 406 KiB | 5 Q