3v4l.org

run code in 500+ PHP versions simultaneously
<?php function notARef() { return 42; } function takesARef(&$ref) {} // Only a notice takesARef(notARef()); // Hard error takesARef(42);
Output for 8.3.0 - 8.3.35, 8.4.1 - 8.4.26, 8.5.0 - 8.5.11
Notice: Only variables should be passed by reference in /in/lE72G on line 10 Fatal error: Uncaught Error: takesARef(): Argument #1 ($ref) could not be passed by reference in /in/lE72G:12 Stack trace: #0 {main} thrown in /in/lE72G on line 12
Output for 8.2.31 - 8.2.34
Notice: Only variables should be passed by reference in /in/lE72G on line 10 Fatal error: Uncaught Error: takesARef(): Argument #1 ($ref) cannot be passed by reference in /in/lE72G:12 Stack trace: #0 {main} thrown in /in/lE72G on line 12

preferences:
32.91 ms | 1140 KiB | 9 Q