3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = [0, 1, 1, 0, 1]; var_dump(array_reduce($arr, function(int $carry, int $item) { return $item === 1 ? $carry + 1 : $carry; }, 0));
Output for hhvm-3.18.5 - 3.22.0, 7.0.30 - 7.2.8
int(3)
Output for 5.6.30
Catchable fatal error: Argument 1 passed to {closure}() must be an instance of int, integer given in /in/i1m14 on line 4
Process exited with code 255.