3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class X { protected $hi = 'protected'; private $test = 'private'; public $public = 'public'; public function test(int $test) { return $test; } } $y = '14'; $x = new X(); var_dump($x->test($y));
based on K3E0K
Output for hhvm-3.18.5 - 3.22.0, 7.0.0 - 7.2.6
int(14)
Output for 5.6.0 - 5.6.30
Catchable fatal error: Argument 1 passed to X::test() must be an instance of int, string given, called in /in/9n491 on line 15 and defined in /in/9n491 on line 8
Process exited with code 255.