<?php class Foo{ function test(int $a, int $b) { echo $a + $b; echo PHP_EOL; } function test2(int $a, $b) { echo $a + $b; echo PHP_EOL; } function test3(int $a, int $b = null) { echo $a + $b; echo PHP_EOL; }} $foo = new Foo;$a = 1;$b = 2;$foo->test($a, $b);
Standard input is empty
Catchable fatal error: Argument 1 passed to Foo::test() must be an instance of int, integer given, called in /home/3AGXqc/prog.php on line 27 and defined in /home/3AGXqc/prog.php on line 5
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!