3v4l.org

run code in 300+ PHP versions simultaneously
<?php class abc { private static $main; private function __construct() { } public function ob($b) { return $b.__FUNCTION__."\n"; } public function __destruct() { echo __FUNCTION__, "\n"; } public function enable() { echo __FUNCTION__, "\n"; self::$main = new self; register_shutdown_function(__CLASS__.'::shutdown'); } public static function shutdown() { echo __FUNCTION__, "\n"; register_shutdown_function(__CLASS__.'::tail'); } public static function tail() { echo __FUNCTION__, "\n"; ob_start(array(self::$main, 'ob')); } } abc::enable();

preferences:
53.23 ms | 402 KiB | 5 Q