3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function f(&$a) { return $a; } $ar = array('a','b','c'); foreach (array_keys($ar) as $key) { $y = &f($ar[$key]); $z[] = &$y; } var_dump($z);
Output for 4.4.0 - 4.4.9, 7.0.0 - 7.1.0
Notice: Only variables should be assigned by reference in /in/eeds3 on line 7 Notice: Only variables should be assigned by reference in /in/eeds3 on line 7 Notice: Only variables should be assigned by reference in /in/eeds3 on line 7 array(3) { [0]=> &string(1) "c" [1]=> &string(1) "c" [2]=> &string(1) "c" }
Output for 5.0.5 - 5.6.28
Strict Standards: Only variables should be assigned by reference in /in/eeds3 on line 7 Strict Standards: Only variables should be assigned by reference in /in/eeds3 on line 7 Strict Standards: Only variables should be assigned by reference in /in/eeds3 on line 7 array(3) { [0]=> &string(1) "c" [1]=> &string(1) "c" [2]=> &string(1) "c" }
Output for 4.3.0 - 4.3.11, 5.0.0 - 5.0.4
array(3) { [0]=> &string(1) "a" [1]=> &string(1) "b" [2]=> &string(1) "c" }