3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __toString() { return $this; } } (string) (new Test);
Output for 8.0.0 - 8.0.11, 8.1rc1 - rc2

Process exited with code 139.
Output for 7.4.0 - 7.4.23
Fatal error: Uncaught Error: Method Test::__toString() must return a string value in /in/Dbe6G:9 Stack trace: #0 {main} thrown in /in/Dbe6G on line 9
Process exited with code 255.
Output for 7.2.0 - 7.2.34, 7.3.0 - 7.3.30
Recoverable fatal error: Method Test::__toString() must return a string value in /in/Dbe6G on line 9
Process exited with code 255.

preferences:
60.83 ms | 461 KiB | 5 Q