3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo "hi"; declare(strict_types=1); try { function welcome(string $name) { echo 'Hello ' . $name; } } catch (Exception $e) { echo "Exception ". $e; } welcome(2);
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.5.24 - 5.5.30, 5.6.8 - 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.

preferences:
155.66 ms | 1400 KiB | 24 Q