3v4l.org

run code in 300+ PHP versions simultaneously
<?php function example($foo) { print $foo; } // Prints ``, nothing. example(null); // Prints `1`, boolean is cast to integer and cast to a string. example(true); // Prints `0` example(0); // Fatal error: Object of class stdClass could not be converted to string. example(new \stdClass);
Output for 8.1.23 - 8.1.28, 8.2.9 - 8.2.19, 8.3.0 - 8.3.7
10 Fatal error: Uncaught Error: Object of class stdClass could not be converted to string in /in/Ih38v:5 Stack trace: #0 /in/Ih38v(18): example(Object(stdClass)) #1 {main} thrown in /in/Ih38v on line 5
Process exited with code 255.

preferences:
42.78 ms | 402 KiB | 30 Q