3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(&$param) { $param = 42; return $param; } $a = 23; echo \$a before calling foo(): $a\n"; $b = &foo($a); echo "\$a after the call to foo(): $a\n"; $b = 23; echo "\$a after touching the returned variable: $a\n"; echo "\$b : $b\n";
Output for 5.4.0 - 5.4.25
Parse error: syntax error, unexpected '$a' (T_VARIABLE), expecting identifier (T_STRING) in /in/e7qnj on line 8
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_VARIABLE, expecting T_STRING in /in/e7qnj on line 8
Process exited with code 255.

preferences:
195.1 ms | 1395 KiB | 62 Q