3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1) ; class Test{ function something(bool $test){ var_dump($test); // "Second dump" } } $value = 'test'; var_dump(is_bool($value)); // "First dump" $test = new Test; $test->something($value);
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
bool(false) Fatal error: Uncaught TypeError: Test::something(): Argument #1 ($test) must be of type bool, string given, called in /in/eLS1T on line 13 and defined in /in/eLS1T:5 Stack trace: #0 /in/eLS1T(13): Test->something('test') #1 {main} thrown in /in/eLS1T on line 5
Process exited with code 255.
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
bool(false) Fatal error: Uncaught TypeError: Argument 1 passed to Test::something() must be of the type bool, string given, called in /in/eLS1T on line 13 and defined in /in/eLS1T:5 Stack trace: #0 /in/eLS1T(13): Test->something('test') #1 {main} thrown in /in/eLS1T on line 5
Process exited with code 255.
Output for 7.0.0 - 7.0.23, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33
bool(false) Fatal error: Uncaught TypeError: Argument 1 passed to Test::something() must be of the type boolean, string given, called in /in/eLS1T on line 13 and defined in /in/eLS1T:5 Stack trace: #0 /in/eLS1T(13): Test->something('test') #1 {main} thrown in /in/eLS1T on line 5
Process exited with code 255.

preferences:
99.61 ms | 1599 KiB | 4 Q