3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php declare(strict_types=1); function sum($a, $b): float { return $a + $b; } var_dump(sum(1, 2)); var_dump(sum(1, 2.5)); ?>
based on NuKT1
Output for 7.0.0 - 7.2.0
float(3) float(3.5)
Output for 5.5.0 - 5.6.28
Warning: Unsupported declare 'strict_types' in /in/oIMAW on line 2 Parse error: syntax error, unexpected ':', expecting '{' in /in/oIMAW on line 4
Process exited with code 255.