3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function test(int $a, int $i = null): void { if ($i === NULL) print("error\n"); else var_dump($i); } test(1, null); test(2, 32); test(3);
Output for 8.4.1 - 8.4.14
Deprecated: test(): Implicitly marking parameter $i as nullable is deprecated, the explicit nullable type must be used instead in /in/utCc3 on line 5 error int(32) error
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27
error int(32) error

preferences:
112.78 ms | 408 KiB | 5 Q