3v4l.org

run code in 500+ PHP versions simultaneously
<?php function foo(string $a = null) {} const A = null; function bar(string $a = A) {} foo(); // Deprecated bar(); // Fatal error ?>
Output for 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
Deprecated: foo(): Implicitly marking parameter $a as nullable is deprecated, the explicit nullable type must be used instead in /in/g846c on line 3 Fatal error: Uncaught TypeError: bar(): Argument #1 ($a) must be of type string, null given, called in /in/g846c on line 10 and defined in /in/g846c:7 Stack trace: #0 /in/g846c(10): bar() #1 {main} thrown in /in/g846c on line 7
Process exited with code 255.
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.31, 8.3.0 - 8.3.31
Fatal error: Uncaught TypeError: bar(): Argument #1 ($a) must be of type string, null given, called in /in/g846c on line 10 and defined in /in/g846c:7 Stack trace: #0 /in/g846c(10): bar() #1 {main} thrown in /in/g846c on line 7
Process exited with code 255.

preferences:
50.18 ms | 894 KiB | 4 Q