3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Bar {} interface Foo { public function aaa(Bar $bar = null); } class Baz implements Foo { public function aaa(Bar $bar = null) {} } class Tab implements Foo { public function aaa(?Bar $bar = null) {} }
Output for 8.4.1
Deprecated: Foo::aaa(): Implicitly marking parameter $bar as nullable is deprecated, the explicit nullable type must be used instead in /in/O6fKY on line 6 Deprecated: Baz::aaa(): Implicitly marking parameter $bar as nullable is deprecated, the explicit nullable type must be used instead in /in/O6fKY on line 10
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14
Output for 7.0.0 - 7.0.20
Parse error: syntax error, unexpected '?', expecting variable (T_VARIABLE) in /in/O6fKY on line 14
Process exited with code 255.

preferences:
81.1 ms | 408 KiB | 5 Q