3v4l.org

run code in 300+ PHP versions simultaneously
<?php class GenClass { function __construct() { echo "Making GenClass\n"; } function __destruct() { echo "Destroying GenClass\n"; } function genInner() { throw new Exception; yield 5; } } function genOuter() { $x = (new GenClass)->genInner(); // $x is now a generator containing the only reference to a GenClass try { yield from $x; } catch (Exception $ex) { echo "Caught Exception (outer)\n"; } } $o = genOuter(); try { $o->next(); } catch (Exception $ex) { echo "Caught Exception (main)\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
Making GenClass Destroying GenClass Caught Exception (outer)

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