3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Tr { public $s; /** * 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; c($tr); // 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 Fatal error: Uncaught Exception: ee in /in/2kbXq:35 Stack trace: #0 /in/2kbXq(25): c(Object(Tr)) #1 /in/2kbXq(39): b() #2 {main} thrown in /in/2kbXq on line 35 __destruct b
Process exited with code 255.

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