3v4l.org

run code in 300+ PHP versions simultaneously
<?php function &returnRef() { global $a; return $a; } function returnVal() { global $a; return $a; } $a = "original"; $b =& returnVal(); $b = "changed"; var_dump($a); //expecting warning + "original" $a = "original"; $b =& returnRef(); $b = "changed"; var_dump($a); //expecting "changed" $b =& 1;
Output for 5.4.0 - 5.4.21
Parse error: syntax error, unexpected '1' (T_LNUMBER) in /in/fEGvr on line 22
Process exited with code 255.
Output for 5.3.0 - 5.3.27
Parse error: syntax error, unexpected T_LNUMBER in /in/fEGvr on line 22
Process exited with code 255.

preferences:
166.13 ms | 1395 KiB | 57 Q