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 { // returning wrong type return "42"; } // calling with wrong type try { hello(1234); } catch (Throwable $t) { echo $t; } try { echo fourtyTwo(); } catch (Throwable $t) { echo $t; }
Output for 7.1.7
1234 42