3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function test(int $X): int|string { if($X % 2 == 0) { return $X * 2; } else { return "{$X}"; } } echo test((int)"13");
based on rDbUc
Output for 7.0.0
Parse error: syntax error, unexpected '|', expecting '{' in /in/puIWs on line 4
Process exited with code 255.
Output for 5.3.20 - 5.6.16
Warning: Unsupported declare 'strict_types' in /in/puIWs on line 2 Parse error: syntax error, unexpected ':', expecting '{' in /in/puIWs on line 4
Process exited with code 255.