3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $a = (object) array(); foreach (array(1,2,3) as $a->foo => $a->bar) { print_r($a); }
Output for 5.1.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
stdClass Object ( [bar] => 1 [foo] => 0 ) stdClass Object ( [bar] => 2 [foo] => 1 ) stdClass Object ( [bar] => 3 [foo] => 2 )
Output for 4.3.0 - 5.0.5
stdClass Object ( [foo] => 0 [bar] => 1 ) stdClass Object ( [foo] => 1 [bar] => 2 ) stdClass Object ( [foo] => 2 [bar] => 3 )