3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Events { private $events; public function add($event, callable $callback) { $this->events[$event][] = $callback; } public function run($event, array $args = []) { if (!isset($this->events[$event])) { return; } foreach ($this->events[$event] as $e) { call_user_func_array($e, $args); } } } $testVar = 1; $events = new Events; $events->add('test', function(&$var) { $var = 2; }); $events->run('test', [&$testVar]); echo $testVar;
Output for git.master, git.master_jit, rfc.property-hooks
2

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