3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $id; function __construct($id=NULL) { $this->id = $id; print "construct\n"; } function __destruct() { if ($this->id === NULL) throw new Exception("destruct failed\n"); print "destruct\n"; } } print "<pre>"; try { $foo = new Foo(); unset($foo); } catch (Exception $e) { print $e->getMessage(); } print "done once\n\n"; try { $foo = new Foo("foo"); unset($foo); } catch (Exception $e) { print $e->getMessage(); } print "done twice";
Output for git.master, git.master_jit, rfc.property-hooks
<pre>construct destruct failed done once construct destruct done twice

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