3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f(bool $b) { var_dump($b); } f(1); f(0); f(null);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
bool(true) bool(false) Fatal error: Uncaught TypeError: f(): Argument #1 ($b) must be of type bool, null given, called in /in/oG8mb on line 7 and defined in /in/oG8mb:3 Stack trace: #0 /in/oG8mb(7): f(NULL) #1 {main} thrown in /in/oG8mb on line 3
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
bool(true) bool(false) Fatal error: Uncaught TypeError: Argument 1 passed to f() must be of the type bool, null given, called in /in/oG8mb on line 7 and defined in /in/oG8mb:3 Stack trace: #0 /in/oG8mb(7): f(NULL) #1 {main} thrown in /in/oG8mb on line 3
Process exited with code 255.
Output for 7.0.0 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33
bool(true) bool(false) Fatal error: Uncaught TypeError: Argument 1 passed to f() must be of the type boolean, null given, called in /in/oG8mb on line 7 and defined in /in/oG8mb:3 Stack trace: #0 /in/oG8mb(7): f(NULL) #1 {main} thrown in /in/oG8mb on line 3
Process exited with code 255.

preferences:
188.37 ms | 402 KiB | 214 Q