3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function sum_int(int $a, int $b) : int { return $a + $b; } function sum_float(float $a, float $b) : float { return $a + $b; } function substract_int(int $a, int $b) : int { return $a - $b; } function substract_float(float $a, float $b) : float { return $a - $b; } function multiply_int(int $a, int $b) : int { return $a * $b; } function multiply_float(float $a, float $b) : float { return $a * $b; } function divide_int(int $a, int $b) : int { return $a / $b; } function divide_float(float $a, float $b) : float { return $a / $b; } echo "La somme de 9 + 14 = " . sum_int(9, 14) . "\r\n"; echo "La somme de 1.895 + 8.105 = " . sum_int(1.895, 8.105) . "\r\n"; echo "La soustraction de 9 - 14 = " . substract_int(9, 14) . "\r\n"; echo "La soustraction de 1.895 - 8.105 = " . substract_int(1.895, 8.105) . "\r\n"; echo "La multiplication de 9 * 14 = " . multiply_int(9, 14) . "\r\n"; echo "La multiplication de 1.895 * 8.105 = " . multiply_int(1.895, 8.105) . "\r\n"; echo "La division de 9 / 14 = " . divide_int(9, 14) . "\r\n"; echo "La division de 1.895 / 8.105 = " . divide_int(1.895, 8.105) . "\r\n";
based on 2R9lV
Output for 7.0.0 - 7.2.0
La somme de 9 + 14 = 23 La somme de 1.895 + 8.105 = 9 La soustraction de 9 - 14 = -5 La soustraction de 1.895 - 8.105 = -7 La multiplication de 9 * 14 = 126 La multiplication de 1.895 * 8.105 = 8 La division de 9 / 14 = 0 La division de 1.895 / 8.105 = 0
Output for 5.3.18 - 5.6.28
Parse error: syntax error, unexpected ':', expecting '{' in /in/bv2AC on line 3
Process exited with code 255.