3v4l.org

run code in 300+ PHP versions simultaneously
<?php $it = new ArrayIterator(range(1, 5)); $cb = 'hello'; $test = new CallbackFilterIterator($it, $cb);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: CallbackFilterIterator::__construct(): Argument #2 ($callback) must 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 7.0.0 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.12 - 7.3.33, 7.4.0 - 7.4.33
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 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.30
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.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.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.3.11, 4.4.0 - 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

preferences:
237.24 ms | 401 KiB | 372 Q