3v4l.org

run code in 300+ PHP versions simultaneously
<?php function byRef(&$a){ var_dump($a); } $y = [1, 2]; byRef(list($x) = $y);
Output for 8.3.0 - 8.3.6
Fatal error: Uncaught Error: byRef(): Argument #1 ($a) could not be passed by reference in /in/JG374:5 Stack trace: #0 {main} thrown in /in/JG374 on line 5
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18
Fatal error: Uncaught Error: byRef(): Argument #1 ($a) cannot be passed by reference in /in/JG374:5 Stack trace: #0 {main} thrown in /in/JG374 on line 5
Process exited with code 255.
Output for 7.4.0 - 7.4.33
Fatal error: Only variables can be passed by reference in /in/JG374 on line 5
Process exited with code 255.
Output for 7.1.25 - 7.1.28, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33
array(2) { [0]=> int(1) [1]=> int(2) }

preferences:
159.72 ms | 402 KiB | 164 Q