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(&$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.0000.06320.12
7.0.00.0100.08720.33
5.6.160.0030.04320.50
5.6.150.0130.08018.27
5.6.140.0030.08318.23
5.6.130.0100.05018.18
5.6.120.0070.04321.00
5.6.110.0130.07721.10
5.6.100.0130.06721.12
5.6.90.0170.07020.95
5.6.80.0130.02720.52
5.5.300.0070.03717.97
5.5.290.0130.07317.98
5.5.280.0030.08320.97
5.5.270.0200.07020.68
5.5.260.0170.06720.78
5.5.250.0100.08320.69
5.5.240.0200.08020.29

preferences:
141.97 ms | 1394 KiB | 7 Q