3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $fruits = array("more" => "apple", "less"=>"orange", "some"=>"banana"); $vegetables = array("more"=>"carrot", "less"=>"brussels sprout","some"=>"onion"); foreach($fruits as &$value){ $value .= "s"; } foreach($vegetables as &$value){ $value .= "s"; } var_dump($fruits,$vegetables);
Output for 5.2.1 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
array(3) { ["more"]=> string(6) "apples" ["less"]=> string(7) "oranges" ["some"]=> string(7) "bananas" } array(3) { ["more"]=> string(7) "carrots" ["less"]=> string(16) "brussels sprouts" ["some"]=> &string(6) "onions" }
Output for 5.0.0 - 5.2.0
array(3) { ["more"]=> &string(6) "apples" ["less"]=> &string(7) "oranges" ["some"]=> &string(7) "bananas" } array(3) { ["more"]=> &string(7) "carrots" ["less"]=> &string(16) "brussels sprouts" ["some"]=> &string(6) "onions" }
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /in/8j8NQ on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected '&', expecting T_VARIABLE or '$' in /in/8j8NQ on line 4
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `T_VARIABLE' or `'$'' in /in/8j8NQ on line 4
Process exited with code 255.