3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function test(int $X): int { return $X * 2; } echo test("13");
based on Ackpd
Output for 7.3.0alpha1 - 7.3.0beta1
Fatal error: Uncaught TypeError: Argument 1 passed to test() must be of the type int, string given, called in /in/rjZYe on line 7 and defined in /in/rjZYe:4 Stack trace: #0 /in/rjZYe(7): test('13') #1 {main} thrown in /in/rjZYe on line 4
Process exited with code 255.
Output for 7.0.0 - 7.2.6
Fatal error: Uncaught TypeError: Argument 1 passed to test() must be of the type integer, string given, called in /in/rjZYe on line 7 and defined in /in/rjZYe:4 Stack trace: #0 /in/rjZYe(7): test('13') #1 {main} thrown in /in/rjZYe on line 4
Process exited with code 255.
Output for 5.3.20 - 5.6.21
Warning: Unsupported declare 'strict_types' in /in/rjZYe on line 2 Parse error: syntax error, unexpected ':', expecting '{' in /in/rjZYe on line 4
Process exited with code 255.