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!'; } })();
Output for 8.4.1 - 8.4.14, 8.5.0 - 8.5.1
Passing E_USER_ERROR to trigger_error() is deprecated since 8.4, throw an exception or call exit with a string message instead
Output for 8.4.15
/bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libm.so.6: version `GLIBC_2.35' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.34' not found (required by /bin/php-8.4.15) /bin/php-8.4.15: /usr/lib/libc.so.6: version `GLIBC_2.38' not found (required by /bin/php-8.4.15)
Process exited with code 1.
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.28
trigger_error was called!

preferences:
100.52 ms | 409 KiB | 5 Q