3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class util { public static function test(): DateTime { return \DateTime::createFromFormat("Y-m-d H:i:s",time()); } } echo util::test();
based on l37O8
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Return value of util::test() must be an instance of DateTime, boolean returned in /in/C2OqK:7 Stack trace: #0 /in/C2OqK(11): util::test() #1 {main} thrown in /in/C2OqK on line 7
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/C2OqK on line 5
Process exited with code 255.