3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump( $iterator = new IteratorIterator(['foo', 'bar']) );
Output for 7.0.0 - 7.2.6
Fatal error: Uncaught TypeError: Argument 1 passed to IteratorIterator::__construct() must implement interface Traversable, array given in /in/sTXtL:3 Stack trace: #0 /in/sTXtL(3): IteratorIterator->__construct(Array) #1 {main} thrown in /in/sTXtL on line 3
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught exception 'Exception' with message 'Need to pass a Traversable that is convertable to an iterator' in /in/sTXtL:3 Stack trace: #0 /in/sTXtL(3): IteratorIterator->__construct() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Catchable fatal error: Argument 1 passed to IteratorIterator::__construct() must implement interface Traversable, array given in /in/sTXtL on line 3
Process exited with code 255.