3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tr { public $s; public static $xx; /** * Tr constructor. * @param $s */ public function __construct($s) { $this->s = $s; } public function __destruct() { echo "__destruct $this->s" . PHP_EOL; } } function b() { $tr = new Tr('b'); echo 'b' . PHP_EOL; try { c($tr); } catch(\Exception $ex) { $tr::$xx = $ex; } // If exception thrown here, Tr::__destruct is called // throw new \Exception('ee'); // Or if you call c() without passing $tr, Tr::__destruct is called } /** * @param Tr $tr */ function c($tr = null) { throw new \Exception('ee'); } b();
Output for git.master, git.master_jit, rfc.property-hooks
b __destruct b

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:
59.98 ms | 401 KiB | 8 Q