3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Test { public function test(string $test, int $test2) { print_r($test); print_r($test2); } } $test = new Test(); $test->test(1, 'test'); $test->test(1, 'test');
based on 9FEcY
Output for 7.1.0 - 7.2.0
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Test has a deprecated constructor in /in/HldsG on line 2 Fatal error: Uncaught ArgumentCountError: Too few arguments to function Test::test(), 0 passed in /in/HldsG on line 11 and exactly 2 expected in /in/HldsG:3 Stack trace: #0 /in/HldsG(11): Test->test() #1 {main} thrown in /in/HldsG on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; Test has a deprecated constructor in /in/HldsG on line 2 Fatal error: Uncaught TypeError: Argument 1 passed to Test::test() must be of the type string, none given, called in /in/HldsG on line 11 and defined in /in/HldsG:3 Stack trace: #0 /in/HldsG(11): Test->test() #1 {main} thrown in /in/HldsG on line 3
Process exited with code 255.
Output for 5.3.19 - 5.6.28
Catchable fatal error: Argument 1 passed to Test::test() must be an instance of string, none given, called in /in/HldsG on line 11 and defined in /in/HldsG on line 3
Process exited with code 255.