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.32, 8.3.0 - 8.3.32, 8.4.1 - 8.4.23, 8.5.0 - 8.5.8
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:
100.78 ms | 899 KiB | 4 Q