3v4l.org

run code in 300+ PHP versions simultaneously
<?php array_push($foo = [0,1,2], [3,4,5]); var_dump($foo); array_push( ($bar = [0,1,2]) , [3,4,5]); var_dump($bar);
Output for 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Fatal error: Uncaught Error: array_push(): Argument #1 ($array) could not be passed by reference in /in/YBkLu:3 Stack trace: #0 {main} thrown in /in/YBkLu on line 3
Process exited with code 255.
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30
Fatal error: Uncaught Error: array_push(): Argument #1 ($array) cannot be passed by reference in /in/YBkLu:3 Stack trace: #0 {main} thrown in /in/YBkLu on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.33
Notice: Only variables should be passed by reference in /in/YBkLu on line 3 array(3) { [0]=> int(0) [1]=> int(1) [2]=> int(2) } Notice: Only variables should be passed by reference in /in/YBkLu on line 6 array(3) { [0]=> int(0) [1]=> int(1) [2]=> int(2) }
Output for 7.3.32 - 7.3.33
array(3) { [0]=> int(0) [1]=> int(1) [2]=> int(2) } array(3) { [0]=> int(0) [1]=> int(1) [2]=> int(2) }
Output for 5.6.38
Strict Standards: Only variables should be passed by reference in /in/YBkLu on line 3 array(3) { [0]=> int(0) [1]=> int(1) [2]=> int(2) } Strict Standards: Only variables should be passed by reference in /in/YBkLu on line 6 array(3) { [0]=> int(0) [1]=> int(1) [2]=> int(2) }

preferences:
87.52 ms | 1684 KiB | 4 Q