3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); class x { function __toString() { return 1; } } echo new x;
Output for 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
Fatal error: Uncaught TypeError: x::__toString(): Return value must be of type string, int returned in /in/cDaOL:7 Stack trace: #0 /in/cDaOL(11): x->__toString() #1 {main} thrown in /in/cDaOL on line 7
Process exited with code 255.

preferences:
34.58 ms | 878 KiB | 4 Q