3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=true); function double(int $value) { return 2 * $value; } function coerceInt(string $value) : int { return (int)$value; } $a = double(coerceInt("5")); var_dump($a); $a = double("5"); var_dump($a);
Output for 5.4.0 - 5.4.45, 5.5.24 - 5.5.30, 5.6.7 - 5.6.14
Warning: Unsupported declare 'strict_types' in /in/76NoK on line 2 Parse error: syntax error, unexpected ':', expecting '{' in /in/76NoK on line 9
Process exited with code 255.

preferences:
188.19 ms | 1395 KiB | 67 Q