3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function ciao() : object { return new \stdClass(); } var_dump(ciao());
based on 71RLZ
Output for 7.2.0 - 7.3.1
object(stdClass)#1 (0) { }
Output for 7.0.0 - 7.1.25
Fatal error: Uncaught TypeError: Return value of ciao() must be an instance of object, instance of stdClass returned in /in/M0neY:4 Stack trace: #0 /in/M0neY(7): ciao() #1 {main} thrown in /in/M0neY on line 4
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught TypeError: Value returned from function ciao() must be of type object, stdClass given in /in/M0neY:4 Stack trace: #0 /in/M0neY(7): ciao() #1 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected ':', expecting '{' in /in/M0neY on line 3
Process exited with code 255.