3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ExitHandler { private static $exitCode = 0; private static $exitHandlers = []; private static $shutdownRegistered = false; public static function onExit(callable $callback, ...$args) { self::$exitHandlers[] = [$callback, $args]; if (!self::$shutdownRegistered) { register_shutdown_function(function() { foreach (self::$exitHandlers as list($handler, $args)) { $handler(self::$exitCode, ...$args); } }); self::$shutdownRegistered = true; } } public static function exit(int $code) { self::$exitCode = $code; exit($code); } } ExitHandler::onExit(function($code) { var_dump($code); }); ExitHandler::exit(123);
Output for git.master, git.master_jit, rfc.property-hooks
int(123)
Process exited with code 123.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
99.26 ms | 1956 KiB | 4 Q