3v4l.org

run code in 300+ PHP versions simultaneously
<?php function create(array $class) { $array = []; foreach($class as $key => $value) { if(is_array($value)) $array =+ [$key => create($value)]; else $array += [$key => $value]; } return $array; } function call(array &$class, string $member, ...$args) { if(!isset($class[$member])) exit($member.' is not a member of the class.'); else { if(!is_callable($class[$member])) return $class[$member]; else { if(!isset($args[0])) $class[$member]($class); } } } const myClass = [ 'foo' => 'Hello World', 'bar' => function bar(&$this) { $this['foo'] = 'Hi!'; } ]; $obj = new(myClass); echo(call($obj, 'foo')); call($obj, 'bar'); echo(call($obj, 'foo'));

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.10.0070.09020.33
7.0.00.0030.05320.20
5.6.160.0030.04020.57
5.6.150.0130.06718.25
5.6.140.0170.07018.23
5.6.130.0070.09018.15
5.6.120.0100.03720.91
5.6.110.0100.04021.05
5.6.100.0030.05020.89
5.6.90.0030.08720.89
5.6.80.0000.04320.41
5.5.300.0130.07317.91
5.5.290.0030.08317.99
5.5.280.0030.05720.81
5.5.270.0170.07320.68
5.5.260.0070.07320.88
5.5.250.0230.06720.70
5.5.240.0370.04720.27

preferences:
142.45 ms | 1394 KiB | 7 Q