3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function foo(int &$int): void { $int = '5'; } foo($x); var_dump($x);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.24, 8.2.0 - 8.2.11
Fatal error: Uncaught TypeError: foo(): Argument #1 ($int) must be of type int, null given, called in /in/rptQ6 on line 8 and defined in /in/rptQ6:4 Stack trace: #0 /in/rptQ6(8): foo(NULL) #1 {main} thrown in /in/rptQ6 on line 4
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type int, null given, called in /in/rptQ6 on line 8 and defined in /in/rptQ6:4 Stack trace: #0 /in/rptQ6(8): foo(NULL) #1 {main} thrown in /in/rptQ6 on line 4
Process exited with code 255.
Output for 7.2.0 - 7.2.34
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be of the type integer, null given, called in /in/rptQ6 on line 8 and defined in /in/rptQ6:4 Stack trace: #0 /in/rptQ6(8): foo(NULL) #1 {main} thrown in /in/rptQ6 on line 4
Process exited with code 255.

preferences:
71.11 ms | 408 KiB | 5 Q