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.30, 8.2.9 - 8.2.25, 8.3.0 - 8.3.14
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:
35.28 ms | 406 KiB | 5 Q