3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); class Test{ function function1():int{ return 'dick'; } } $test = new Test(); echo $test->function1();
based on dTdIX
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Return value of Test::function1() must be of the type integer, string returned in /in/8E6No:8 Stack trace: #0 /in/8E6No(14): Test->function1() #1 {main} thrown in /in/8E6No on line 8
Process exited with code 255.
Output for 5.3.21 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/8E6No on line 2 Parse error: syntax error, unexpected ':', expecting ';' or '{' in /in/8E6No on line 7
Process exited with code 255.