3v4l.org

run code in 500+ PHP versions simultaneously
<?php const A = 1; function &foo(&$a) { return []; } $a = 1; $a = foo($a); // Notice: Only variable references should be returned by reference foo(1); // Fatal error: Uncaught Error: foo(): Argument #1 ($a) cannot be passed by reference ?>
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.21, 8.5.0 - 8.5.6
Notice: Only variable references should be returned by reference in /in/6knLV on line 6 Fatal error: Uncaught Error: foo(): Argument #1 ($a) could not be passed by reference in /in/6knLV:13 Stack trace: #0 {main} thrown in /in/6knLV on line 13
Process exited with code 255.
Output for 8.1.34, 8.2.0 - 8.2.30
Notice: Only variable references should be returned by reference in /in/6knLV on line 6 Fatal error: Uncaught Error: foo(): Argument #1 ($a) cannot be passed by reference in /in/6knLV:13 Stack trace: #0 {main} thrown in /in/6knLV on line 13
Process exited with code 255.

preferences:
52.82 ms | 873 KiB | 4 Q