3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $array = array( new StdClass, new StdClass ); foreach ($array as $obj) { $obj->var = true; } var_dump($array);
Output for 5.0.0 - 7.1.0
array(2) { [0]=> object(stdClass)#1 (1) { ["var"]=> bool(true) } [1]=> object(stdClass)#2 (1) { ["var"]=> bool(true) } }
Output for 4.3.0 - 4.4.9
array(2) { [0]=> object(stdClass)(0) { } [1]=> object(stdClass)(0) { } }