3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $it = new ArrayIterator(range(1, 5)); $cb = 'hello'; $test = new CallbackFilterIterator($it, $cb);
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught TypeError: CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, function 'hello' not found or invalid function name in /in/uoNCC:5 Stack trace: #0 /in/uoNCC(5): CallbackFilterIterator->__construct(Object(ArrayIterator), 'hello') #1 {main} thrown in /in/uoNCC on line 5
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
Catchable fatal error: Argument 2 passed to CallbackFilterIterator::__construct() must be an instance of callable, string given in /in/uoNCC on line 5
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'CallbackFilterIterator::__construct() expects parameter 2 to be a valid callback, function 'hello' not found or invalid function name' in /in/uoNCC:5 Stack trace: #0 /in/uoNCC(5): CallbackFilterIterator->__construct(Object(ArrayIterator), 'hello') #1 {main} thrown in /in/uoNCC on line 5
Process exited with code 255.
Output for 5.0.0 - 5.3.29
Fatal error: Class 'CallbackFilterIterator' not found in /in/uoNCC on line 5
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: arrayiterator in /in/uoNCC on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: arrayiterator in /in/uoNCC on line 3