3v4l.org

run code in 200+ 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 - 7.2.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 )