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(six);
based on ieM79
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/c4tc8:4 Stack trace: #0 /in/c4tc8(6): multiply(2, 3) #1 {main} thrown in /in/c4tc8 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/c4tc8:4 Stack trace: #0 /in/c4tc8(6): multiply(2, 3) #1 {main} thrown in /in/c4tc8 on line 4
Process exited with code 255.