3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo "hi"; declare(strict_types=1); try { function welcome(string $name) { echo 'Hello ' . $name; } } catch (Exception $e) { echo "Exception ". $e; } welcome(2);
based on ClY2g
Output for 7.0.0
Fatal error: strict_types declaration must be the very first statement in the script in /in/4jI4U on line 3
Process exited with code 255.
Output for 5.3.20 - 5.6.16
Warning: Unsupported declare 'strict_types' in /in/4jI4U on line 3 hi Catchable fatal error: Argument 1 passed to welcome() must be an instance of string, integer given, called in /in/4jI4U on line 12 and defined in /in/4jI4U on line 6
Process exited with code 255.