3v4l.org

run code in 200+ php & hhvm versions
<?php declare(strict_types=1); function multiply(float $a, float $b): int { return $a * $b; } $six = multiply(2, 3); echo gettype($a, $b);
based on b66lE
Output for 7.3.0 - 7.4.0beta4
Fatal error: Uncaught TypeError: Return value of multiply() must be of the type int, float returned in /in/VMCT0:4 Stack trace: #0 /in/VMCT0(6): multiply(2, 3) #1 {main} thrown in /in/VMCT0 on line 4
Process exited with code 255.
Output for 7.1.25 - 7.2.22
Fatal error: Uncaught TypeError: Return value of multiply() must be of the type integer, float returned in /in/VMCT0:4 Stack trace: #0 /in/VMCT0(6): multiply(2, 3) #1 {main} thrown in /in/VMCT0 on line 4
Process exited with code 255.