3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); class Foo {} function test(string $num) : Foo { return (int) $num; } echo test('5');
based on aeAS7
Output for 7.0.0 - 7.2.0
Fatal error: Uncaught TypeError: Return value of test() must be an instance of Foo, integer returned in /in/rfEO7:9 Stack trace: #0 /in/rfEO7(12): test('5') #1 {main} thrown in /in/rfEO7 on line 9
Process exited with code 255.
Output for 5.3.20 - 5.6.21
Warning: Unsupported declare 'strict_types' in /in/rfEO7 on line 3 Parse error: syntax error, unexpected ':', expecting '{' in /in/rfEO7 on line 7
Process exited with code 255.