3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); use JetBrains\PhpStorm\NoReturn; \set_error_handler(static function (int $errno, string $errstr, string $errfile, int $errline): bool { throw new \ErrorException($errstr, 0, $errno, $errfile, $errline); }); //\register_shutdown_function(static function (): void { // $error = \error_get_last(); // // if ($error !== null) { // throw new \ErrorException($error['message'], 0, $error['type'], $error['file'], $error['line']); // } //}); echo (new class { #[NoReturn] public function __invoke(): string { try { trigger_error('trigger_error was called!', E_USER_ERROR); exit('exit was called!'); return 'Hello, World!'; } catch (\Throwable $e) { return $e->getMessage(); } return 'exit was skipped!'; } })();

preferences:
32.93 ms | 405 KiB | 5 Q