3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $t = new Test; $t->test(['val2', 'val3']); class Test { public function test(array $val){ foreach ($val as $v) { echo $v, PHP_EOL; } } }
Output for 7.1.0 - 7.3.0alpha1
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/Z2XFD on line 6 Fatal error: Uncaught ArgumentCountError: Too few arguments to function Test::test(), 0 passed in /in/Z2XFD on line 3 and exactly 1 expected in /in/Z2XFD:7 Stack trace: #0 /in/Z2XFD(3): Test->test() #1 {main} thrown in /in/Z2XFD on line 7
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/Z2XFD on line 6 Fatal error: Uncaught TypeError: Argument 1 passed to Test::test() must be of the type array, none given, called in /in/Z2XFD on line 3 and defined in /in/Z2XFD:7 Stack trace: #0 /in/Z2XFD(3): Test->test() #1 {main} thrown in /in/Z2XFD on line 7
Process exited with code 255.
Output for 5.6.0 - 5.6.25
Catchable fatal error: Argument 1 passed to Test::test() must be of the type array, none given, called in /in/Z2XFD on line 3 and defined in /in/Z2XFD on line 7
Process exited with code 255.