3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @return int|null */ function divide(int $dividend, int $divisor): ?int { if (0 === $divisor) { return null; } return intdiv($dividend, $divisor); } function success(int $result): string { return sprintf('Result: %d', $result); } echo success(divide(10, 0));
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught TypeError: success(): Argument #1 ($result) must be of type int, null given, called in /in/8Rb8W on line 19 and defined in /in/8Rb8W:15 Stack trace: #0 /in/8Rb8W(19): success(NULL) #1 {main} thrown in /in/8Rb8W on line 15
Process exited with code 255.

preferences:
77.88 ms | 402 KiB | 62 Q