3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = array( 'a' => 'A', 'b' => 'B', 'c' => 'C'); var_dump($arr); foreach ($arr as &$val) { if ($val == 'B') { unset($val); } } var_dump($arr); foreach ($arr as &$val) { if ($val == 'B') { $val = 'X'; } } var_dump($arr);

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Typed properties v2
array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "B" ["c"]=> string(1) "C" } array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "B" ["c"]=> &string(1) "C" } array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "X" ["c"]=> &string(1) "C" }
Output for Array change keys
array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "B" ["c"]=> string(1) "C" } array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "B" ["c"]=> &string(1) "C" } array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "X" ["c"]=> &string(1) "C" }
Output for Lexical anon
array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "B" ["c"]=> string(1) "C" } array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "B" ["c"]=> &string(1) "C" } array(3) { ["a"]=> string(1) "A" ["b"]=> string(1) "X" ["c"]=> &string(1) "C" }

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page