3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class A implements \IteratorAggregate { public function getIterator() { foreach (range(1, 3) as $item) { yield new \stdClass() => $item; } } } foreach (new A() as $k => $v) { var_dump($k, $v); }
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.3.0rc3
object(stdClass)#4 (0) { } int(1) object(stdClass)#5 (0) { } int(2) object(stdClass)#4 (0) { } int(3)
Output for hhvm-3.15.4
object(stdClass)#3 (0) { } int(1) object(stdClass)#4 (0) { } int(2) object(stdClass)#5 (0) { } int(3)