3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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"
Output for 4.4.0 - 4.4.9, 7.0.0 - 7.1.0
Notice: Only variables should be assigned by reference in /in/mRBD3 on line 13 string(8) "original" string(7) "changed"
Output for 5.0.5, 5.1.1 - 5.6.28
Strict Standards: Only variables should be assigned by reference in /in/mRBD3 on line 13 string(8) "original" string(7) "changed"
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/mRBD3 on line 20
Process exited with code 255.
Output for 4.3.0 - 4.3.11, 5.0.0 - 5.0.4
string(8) "original" string(7) "changed"