3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function setAge(int $age) { var_dump($age); } // First test is clearly wrong // setAge("totally not an int"); <-- Fatal error expected int found string // Try passing something like this setAge("30+1"); // What about this? setAge("30"); // Finally a real int :) setAge(30); // U jelly? setAge(.1);
based on OIDal
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to setAge() must be of the type integer, string given, called in /in/b16nd on line 12 and defined in /in/b16nd:4 Stack trace: #0 /in/b16nd(12): setAge('30+1') #1 {main} thrown in /in/b16nd on line 4
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/b16nd on line 2 Catchable fatal error: Argument 1 passed to setAge() must be an instance of int, string given, called in /in/b16nd on line 12 and defined in /in/b16nd on line 4
Process exited with code 255.