3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x = (object) ['a'=> 1]; if ($x) { echo "if\n"; } function takes_bool(bool $param) {} takes_bool($x);
Output for 8.0.1 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
if Fatal error: Uncaught TypeError: takes_bool(): Argument #1 ($param) must be of type bool, stdClass given, called in /in/fCQFL on line 11 and defined in /in/fCQFL:9 Stack trace: #0 /in/fCQFL(11): takes_bool(Object(stdClass)) #1 {main} thrown in /in/fCQFL on line 9
Process exited with code 255.
Output for 7.4.0 - 7.4.33
if Fatal error: Uncaught TypeError: Argument 1 passed to takes_bool() must be of the type bool, object given, called in /in/fCQFL on line 11 and defined in /in/fCQFL:9 Stack trace: #0 /in/fCQFL(11): takes_bool(Object(stdClass)) #1 {main} thrown in /in/fCQFL on line 9
Process exited with code 255.

preferences:
117.74 ms | 401 KiB | 121 Q