3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types = 1); class x { function __toString() : string { return "abc"; } } $x = new x; print $x . " and $x\n"; print $x; echo $x; echo PHP_EOL; print implode(', ', [$x, $x]); print implode($x, [1, 2]); ?>
Output for 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
abc and abc abcabc abc, abc Fatal error: Uncaught TypeError: implode(): Argument #1 ($separator) must be of type string, x given in /in/R6XVR:17 Stack trace: #0 /in/R6XVR(17): implode(Object(x), Array) #1 {main} thrown in /in/R6XVR on line 17
Process exited with code 255.
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.31, 8.3.0 - 8.3.31
abc and abc abcabc abc, abc Fatal error: Uncaught TypeError: implode(): Argument #1 ($separator) must be of type array|string, x given in /in/R6XVR:17 Stack trace: #0 /in/R6XVR(17): implode(Object(x), Array) #1 {main} thrown in /in/R6XVR on line 17
Process exited with code 255.

preferences:
66.07 ms | 1050 KiB | 4 Q