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;

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.0.120.0070.08022.10
7.0.110.0070.06322.07
7.0.100.0100.06022.06
7.0.90.0100.06022.06
7.0.80.0130.06321.94
7.0.70.0130.06022.13
7.0.60.0100.05322.07
7.0.50.0100.05721.99
7.0.40.0170.04722.16
7.0.30.0130.05321.99
7.0.20.0070.07322.04
7.0.10.0170.06322.07
7.0.00.0100.05322.12
5.6.270.0030.08321.04
5.6.260.0030.08020.89
5.6.250.0130.06020.88
5.6.240.0070.06021.05
5.6.230.0100.08021.12
5.6.220.0000.07021.02
5.6.210.0100.05320.96
5.6.200.0100.05721.01
5.6.190.0100.06020.95
5.6.180.0070.05721.06
5.6.170.0070.06021.05
5.6.160.0070.07721.05
5.6.150.0100.07020.87
5.6.140.0070.06021.00
5.6.130.0270.04021.10
5.6.120.0130.08021.05
5.6.110.0130.06320.86
5.6.100.0130.06320.76
5.6.90.0130.05320.93
5.6.80.0000.06020.25
5.6.70.0130.05720.39
5.6.60.0070.08020.40
5.6.50.0130.05720.20
5.6.40.0000.06020.19
5.6.30.0030.06720.41
5.6.20.0130.05720.30
5.6.10.0030.05720.41
5.6.00.0130.05320.19

preferences:
138.79 ms | 1398 KiB | 7 Q