3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function add(int $a, int $b) { return $a + $b; } $a = 5; $b = 3; settype($a, int); settype($b, int); echo(add($a, $b));
based on Wfb2M
Output for 7.2.0
Warning: Use of undefined constant int - assumed 'int' (this will throw an Error in a future version of PHP) in /in/7kpRc on line 9 Warning: Use of undefined constant int - assumed 'int' (this will throw an Error in a future version of PHP) in /in/7kpRc on line 10 8
Output for 7.0.0 - 7.1.10
Notice: Use of undefined constant int - assumed 'int' in /in/7kpRc on line 9 Notice: Use of undefined constant int - assumed 'int' in /in/7kpRc on line 10 8
Output for 5.3.20 - 5.6.28
Notice: Use of undefined constant int - assumed 'int' in /in/7kpRc on line 9 Notice: Use of undefined constant int - assumed 'int' in /in/7kpRc on line 10 Catchable fatal error: Argument 1 passed to add() must be an instance of int, integer given, called in /in/7kpRc on line 11 and defined in /in/7kpRc on line 3
Process exited with code 255.