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.0030.08720.12
7.0.00.0070.09020.29
5.6.160.0030.04020.51
5.6.150.0030.04318.21
5.6.140.0100.06318.29
5.6.130.0100.05718.19
5.6.120.0100.05321.03
5.6.110.0070.08320.99
5.6.100.0030.06021.14
5.6.90.0030.06321.04
5.6.80.0000.04720.40
5.5.300.0070.04318.04
5.5.290.0070.04317.99
5.5.280.0070.09020.90
5.5.270.0130.08320.73
5.5.260.0030.08020.68
5.5.250.0100.07720.57
5.5.240.0230.06720.16

preferences:
141.12 ms | 1394 KiB | 7 Q