3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo implements IteratorAggregate { public function getIterator() { return new ArrayIterator([]); }} function foo(iterable $bar) { var_dump($bar); } foo(new Foo());
Output for 7.1.0 - 7.3.0
object(Foo)#1 (0) { }
Output for 7.0.0 - 7.0.33
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be an instance of iterable, instance of Foo given, called in /in/ios53 on line 7 and defined in /in/ios53:5 Stack trace: #0 /in/ios53(7): foo(Object(Foo)) #1 {main} thrown in /in/ios53 on line 5
Process exited with code 255.
Output for hhvm-3.22.0
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be an instance of iterable, Foo given in /in/ios53:-1 Stack trace: #0 /in/ios53(-1): foo() #1 {main}
Process exited with code 255.
Output for hhvm-3.18.5 - 3.21.3
Fatal error: Uncaught TypeError: Argument 1 passed to foo() must be an instance of iterable, Foo given in /in/ios53:5 Stack trace: #0 /in/ios53(7): foo() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.38
Catchable fatal error: Argument 1 passed to foo() must be an instance of iterable, instance of Foo given, called in /in/ios53 on line 7 and defined in /in/ios53 on line 5
Process exited with code 255.