3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); try { function welcome(string $name) { echo 'Hello ' . $name; } } catch (Exception $e) { echo "Exception ". $e; } welcome(2);
based on 5GZPr
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Argument 1 passed to welcome() must be of the type string, integer given, called in /in/ClY2g on line 11 and defined in /in/ClY2g:5 Stack trace: #0 /in/ClY2g(11): welcome(2) #1 {main} thrown in /in/ClY2g on line 5
Process exited with code 255.
Output for 5.3.20 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/ClY2g on line 2 Catchable fatal error: Argument 1 passed to welcome() must be an instance of string, integer given, called in /in/ClY2g on line 11 and defined in /in/ClY2g on line 5
Process exited with code 255.