3v4l.org

run code in 300+ PHP versions simultaneously
<?php class stdobject { public function __call($method, $arguments) { if (isset($this->{$method}) && is_callable($this->{$method})) { return call_user_func_array($this->{$method}, $arguments); } else { throw new Exception("Fatal error: Call to undefined method: $method"); } } } $mod = function() { $test = new stdobject(); $opmode=null; $mode='somemode'; $ref2=&$mode; $test->init = function ($params) use (&$opmode) { $opmode = &$params['opmode']; }; $test->setup = function () use (&$opmode,&$mode) { $opmode = 'test'; $mode='someothermode'; }; $test->print=function() use (&$opmode,&$mode){ echo $opmode; echo $mode; }; return $test; }; $test = $mod(); $opmode = 'helloworld'; $test->init(['opmode' => &$opmode]); $test->setup(); $test->print(); echo $opmode;
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property stdobject::$init is deprecated in /in/3YEkB on line 20 Deprecated: Creation of dynamic property stdobject::$setup is deprecated in /in/3YEkB on line 24 Deprecated: Creation of dynamic property stdobject::$print is deprecated in /in/3YEkB on line 29 testsomeothermodehelloworld

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