3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class MyClass { } function myFunc() : MyClass { return null; } print_r(myFunc());
based on n2jNZ
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Return value of myFunc() must be an instance of MyClass, null returned in /in/ige7E:10 Stack trace: #0 /in/ige7E(13): myFunc() #1 {main} thrown in /in/ige7E on line 10
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Parse error: syntax error, unexpected ':', expecting '{' in /in/ige7E on line 8
Process exited with code 255.