3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(count(new CallbackFilterIterator(new ArrayIterator([1,2,3,4], function ($i) { return $i % 2; }))));
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught TypeError: ArrayIterator::__construct() expects parameter 2 to be integer, object given in /in/SVluR:3 Stack trace: #0 /in/SVluR(3): ArrayIterator->__construct(Array, Object(Closure)) #1 {main} thrown in /in/SVluR on line 3
Process exited with code 255.
Output for hhvm-3.12.0 - 3.13.2
Warning: __construct() expects exactly 2 parameters, 1 given in /in/SVluR on line 3 Fatal error: Uncaught TypeError: Argument 2 passed to CallbackFilterIterator::__construct() must be an instance of callable, undefined variable given in /in/SVluR:3 Stack trace: #0 /in/SVluR(3): CallbackFilterIterator->__construct() #1 {main}
Process exited with code 255.
Output for hhvm-3.10.0
Warning: __construct() expects exactly 2 parameters, 1 given in /in/SVluR on line 3 Catchable fatal error: Argument 2 passed to CallbackFilterIterator::__construct() must be an instance of callable, undefined variable given in /in/SVluR on line 3
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Fatal error: Uncaught exception 'InvalidArgumentException' with message 'ArrayIterator::__construct() expects parameter 2 to be long, object given' in /in/SVluR:3 Stack trace: #0 /in/SVluR(3): ArrayIterator->__construct(Array, Object(Closure)) #1 {main} thrown in /in/SVluR on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[', expecting ')' in /in/SVluR on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[', expecting ')' in /in/SVluR on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/SVluR on line 3
Process exited with code 255.