3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ThrowExceptions extends Exception { public static function alreadySent(string $name) { return new static("The campaign {$name} is already sent"); } } class TryThrow { public static function doThrow () { throw ThrowExceptions::alreadySent("Example"); } } TryThrow::doThrow();
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28, 8.4.1 - 8.4.15, 8.5.0 - 8.5.1
Fatal error: Uncaught ThrowExceptions: The campaign Example is already sent in /in/HiWun:7 Stack trace: #0 /in/HiWun(15): ThrowExceptions::alreadySent('Example') #1 /in/HiWun(20): TryThrow::doThrow() #2 {main} thrown in /in/HiWun on line 7
Process exited with code 255.

preferences:
192.46 ms | 408 KiB | 5 Q