3v4l.org

run code in 300+ PHP versions simultaneously
<?php class AccessBroker { public function login(string $username, string $password): void { // Pretend that we're attempting to log the user in, but something throws an exception. throw new \Exception('Oops, something went wrong!'); } } (new AccessBroker)->login('chris', 'secret password');
Output for 7.3.0 - 7.3.33, 7.4.0 - 7.4.27, 8.0.0 - 8.0.14, 8.1.0 - 8.1.2
Fatal error: Uncaught Exception: Oops, something went wrong! in /in/vsZP6:8 Stack trace: #0 /in/vsZP6(12): AccessBroker->login('chris', 'secret password') #1 {main} thrown in /in/vsZP6 on line 8
Process exited with code 255.

preferences:
32.37 ms | 460 KiB | 5 Q