3v4l.org

run code in 200+ PHP versions simultaneously
<?php // this will fail type-checking /** @psalm-var list<int> $b */ $b = array_filter([1, 2, 3], function (int $v) { return $v !== 2; }); echo json_encode($b);
Output for 7.0.0 - 7.4.0rc4
{"0":1,"2":3}
Output for 5.4.0 - 5.6.40
Catchable fatal error: Argument 1 passed to {closure}() must be an instance of int, integer given in /in/oUoK2 on line 5
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/oUoK2 on line 5
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/oUoK2 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `')'' in /in/oUoK2 on line 5
Process exited with code 255.