3v4l.org

run code in 300+ 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.30, 8.4.1 - 8.4.17, 8.5.0 - 8.5.2
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
Process exited with code 255.

preferences:
66.38 ms | 406 KiB | 5 Q