3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class ArrayAccessImpl implements ArrayAccess { private $container = array(); public function __construct($a) { $this->container = $a; } public function offsetSet($offset, $value) { if (is_null($offset)) { $this->container[] = $value; } else { $this->container[$offset] = $value; } } public function offsetExists($offset) { return isset($this->container[$offset]); } public function offsetUnset($offset) { unset($this->container[$offset]); } public function offsetGet($offset) { return isset($this->container[$offset]) ? $this->container[$offset] : null; } } list($a, $b) = new ArrayAccessImpl([9 => 1, 8 => 2]); var_dump($a, $b);
based on 9ITpr

Here you find the average performance (time & memory) of each version. A greyed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0050.00519.46
7.1.100.0070.00718.20
7.1.70.0090.00617.17
7.1.60.0070.01719.22
7.1.50.0130.00316.32
7.1.00.0100.06722.54
7.0.200.0050.00216.46
7.0.140.0000.07022.05
7.0.110.0300.07720.02
7.0.100.0170.07019.91
7.0.90.0130.08020.02
7.0.80.0130.07720.02
7.0.70.0130.08319.93
7.0.60.0070.08720.07
7.0.50.0130.04719.93
7.0.40.0070.08319.76
7.0.30.0030.08019.88
7.0.20.0100.04019.81
7.0.10.0100.07719.65
7.0.00.0100.03719.73
5.6.280.0030.07720.82
5.6.260.0100.08020.73
5.6.250.0070.08320.60
5.6.240.0130.04320.49
5.6.230.0100.08020.69
5.6.220.0070.04020.69
5.6.210.0130.07720.82
5.6.200.0030.04320.57
5.6.190.0070.08720.64
5.6.180.0100.07020.58
5.6.170.0070.05320.65
5.6.160.0130.07720.63
5.6.150.0030.09020.69
5.6.140.0130.07020.66
5.6.130.0130.07720.60
5.6.120.0230.06720.47
5.6.110.0170.06720.55
5.6.100.0070.08020.55
5.6.90.0100.07720.68
5.6.80.0130.07019.95
5.6.70.0070.07320.24
5.6.60.0070.07720.23
5.6.50.0070.07320.05
5.6.40.0100.06320.00
5.6.30.0100.07019.87
5.6.20.0030.08719.99
5.6.10.0070.03320.02
5.6.00.0070.07719.98
5.5.380.0100.07717.52
5.5.370.0100.03717.59
5.5.360.0130.07317.68
5.5.350.0130.07717.48
5.5.340.0170.05317.93
5.5.330.0100.04317.93
5.5.320.0070.08018.26
5.5.310.0000.09017.96
5.5.300.0170.07017.96
5.5.290.0130.06717.92
5.5.280.0030.05018.25
5.5.270.0070.04018.06
5.5.260.0100.06317.90
5.5.250.0170.06717.77
5.5.240.0070.06717.48
5.5.230.0100.07717.29
5.5.220.0070.07017.20
5.5.210.0100.08017.29
5.5.200.0130.07317.61
5.5.190.0070.07017.27
5.5.180.0030.03717.18
5.5.160.0000.03717.45
5.5.150.0130.03717.58
5.5.140.0100.06717.44
5.5.130.0070.06317.42
5.5.120.0030.08717.58
5.5.110.0030.07717.25
5.5.100.0030.03717.18
5.5.90.0030.07017.38
5.5.80.0030.07017.34
5.5.70.0130.06017.36
5.5.60.0030.08017.32
5.5.50.0100.06317.20
5.5.40.0030.06717.07
5.5.30.0030.04317.38
5.5.20.0070.06717.33
5.5.10.0130.07017.14
5.5.00.0130.07017.33
5.4.450.0070.04019.47
5.4.440.0130.07319.42
5.4.430.0030.05319.27
5.4.420.0100.06319.30
5.4.410.0170.06719.18
5.4.400.0030.07319.09
5.4.390.0100.06019.18
5.4.380.0030.04319.19
5.4.370.0070.07719.34
5.4.360.0130.06719.00
5.4.350.0030.07719.31
5.4.340.0030.07719.24
5.4.320.0030.03719.00
5.4.310.0030.05319.03
5.4.300.0070.07018.98
5.4.290.0000.08718.98
5.4.280.0000.04319.03
5.4.270.0130.07319.24
5.4.260.0100.07018.94
5.4.250.0030.04019.23
5.4.240.0070.06719.08
5.4.230.0030.04319.13
5.4.220.0100.07718.95
5.4.210.0030.03718.93
5.4.200.0130.07019.15
5.4.190.0130.06019.02
5.4.180.0100.07719.16
5.4.170.0070.07719.20
5.4.160.0070.08018.96
5.4.150.0000.08019.14
5.4.140.0070.07316.61
5.4.130.0030.04316.34
5.4.120.0100.07316.38
5.4.110.0030.04716.65
5.4.100.0130.06316.41
5.4.90.0170.04716.31
5.4.80.0030.03716.46
5.4.70.0070.07316.54
5.4.60.0100.07016.38
5.4.50.0070.07316.52
5.4.40.0130.07016.28
5.4.30.0030.04316.29
5.4.20.0030.07316.54
5.4.10.0030.04716.48
5.4.00.0200.04015.83
5.3.290.0000.07314.82
5.3.280.0100.07314.70
5.3.270.0070.07314.60
5.3.260.0070.05014.63
5.3.250.0130.07014.64
5.3.240.0100.07014.63
5.3.230.0100.07014.57
5.3.220.0170.05314.58
5.3.210.0000.08314.60
5.3.200.0070.07314.66
5.3.190.0030.07714.57
5.3.180.0070.06314.59
5.3.170.0100.07014.80
5.3.160.0070.07314.80
5.3.150.0070.07014.58
5.3.140.0070.07314.42
5.3.130.0070.07714.52
5.3.120.0000.06014.57
5.3.110.0070.04314.55
5.3.100.0100.04714.08
5.3.90.0030.07314.04
5.3.80.0030.04314.15
5.3.70.0030.04714.16
5.3.60.0070.04014.09
5.3.50.0070.06713.95
5.3.40.0130.06014.09
5.3.30.0030.07313.93
5.3.20.0000.07713.73
5.3.10.0270.02013.67
5.3.00.0030.07313.68
5.2.170.0100.05311.93
5.2.160.0030.03011.93
5.2.150.0030.06311.93
5.2.140.0070.05311.93
5.2.130.0100.03011.93
5.2.120.0030.06011.93
5.2.110.0030.05711.93
5.2.100.0070.05711.93
5.2.90.0030.05711.93
5.2.80.0100.05711.93
5.2.70.0100.03011.93
5.2.60.0030.04011.93
5.2.50.0030.06011.93
5.2.40.0000.06311.93
5.2.30.0030.04311.93
5.2.20.0030.03311.93
5.2.10.0070.04311.93
5.2.00.0130.05311.93
5.1.60.0000.06011.93
5.1.50.0070.05011.93
5.1.40.0030.05711.93
5.1.30.0030.04711.93
5.1.20.0030.06011.93
5.1.10.0030.05311.93
5.1.00.0070.05311.93
5.0.50.0030.03011.93
5.0.40.0000.03311.93
5.0.30.0070.06011.93
5.0.20.0000.04311.93
5.0.10.0070.02711.93
5.0.00.0100.05711.93
4.4.90.0000.03711.93
4.4.80.0000.03711.93
4.4.70.0000.02711.93
4.4.60.0000.03011.93
4.4.50.0000.02311.93
4.4.40.0070.03311.93
4.4.30.0030.03311.93
4.4.20.0000.03711.93
4.4.10.0070.03011.93
4.4.00.0070.05011.93
4.3.110.0070.01711.93
4.3.100.0000.03311.93
4.3.90.0000.03311.93
4.3.80.0030.04711.93
4.3.70.0000.03311.93
4.3.60.0070.02311.93
4.3.50.0000.03711.93
4.3.40.0070.04711.93
4.3.30.0000.03711.93
4.3.20.0030.03311.93
4.3.10.0030.02711.93
4.3.00.0030.03311.93