3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types = 1); function hello(string $s) : void { echo "$s\n"; } function fourtyTwo() : int { return "42"; } $i = hello("1234"); echo $i;
Output for 7.1.7
1234
Output for 7.0.20
1234 Fatal error: Uncaught TypeError: Return value of hello() must be an instance of void, none returned in /in/4KXn6:6 Stack trace: #0 /in/4KXn6(12): hello('1234') #1 {main} thrown in /in/4KXn6 on line 6
Process exited with code 255.