3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function doSomething(string $value) : int { try { $value .= " test" / 34; } catch(Throwable $e) { var_dump($e); } return $value; } echo doSomething("Hello");
based on bE04T
Output for 7.1.0 - 7.2.0
Warning: A non-numeric value encountered in /in/r3kbD on line 6 Fatal error: Uncaught TypeError: Return value of doSomething() must be of the type integer, string returned in /in/r3kbD:10 Stack trace: #0 /in/r3kbD(13): doSomething('Hello0') #1 {main} thrown in /in/r3kbD on line 10
Process exited with code 255.
Output for 7.0.0 - 7.0.20
Fatal error: Uncaught TypeError: Return value of doSomething() must be of the type integer, string returned in /in/r3kbD:10 Stack trace: #0 /in/r3kbD(13): doSomething('Hello0') #1 {main} thrown in /in/r3kbD on line 10
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Parse error: syntax error, unexpected ':', expecting '{' in /in/r3kbD on line 3
Process exited with code 255.