3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Collection implements \ArrayAccess, \Iterator { private $_array = array(); public function __invoke() { return $this->_array; } public function offsetExists($offset) { return array_key_exists($offset, $this->_array); } public function offsetGet($offset) { return $this->_array[$offset]; } public function offsetSet($offset, $value) { $this->_array[$offset] = $value; } public function offsetUnset($offset) { unset($this->_array[$offset]); } public function current() { return current($this->_array); } public function key() { return key($this->_array); } public function next() { return next($this->_array); } public function rewind() { return reset($this->_array); } public function valid() { return !is_null(key($this->_array)); } } $a = new Collection(); $a['alpha'] = 'blah'; $a['beta'] = 'yada'; $a['gamma'] = 'woot'; var_dump(current($a)); var_dump(next($a));

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)
8.4.120.0100.01120.71
8.4.110.0140.00724.31
8.4.100.0040.00619.56
8.4.90.0130.00818.63
8.4.80.0100.00819.40
8.4.70.0080.01218.37
8.4.60.0050.00718.56
8.4.50.0050.00424.14
8.4.40.0070.01419.79
8.4.30.0080.01219.40
8.4.20.0110.01417.97
8.4.10.0090.00019.73
8.3.250.0120.00818.88
8.3.240.0120.00816.87
8.3.230.0120.00916.47
8.3.220.0080.00619.11
8.3.210.0040.00318.38
8.3.200.0050.00416.75
8.3.190.0080.00618.92
8.3.180.0080.01116.72
8.3.170.0040.00416.76
8.3.160.0100.01016.92
8.3.150.0160.00319.13
8.3.140.0060.01219.04
8.3.130.0090.00018.39
8.3.120.0160.00018.81
8.3.110.0060.00320.94
8.3.100.0040.00416.80
8.3.90.0080.00026.77
8.3.80.0060.00317.97
8.3.70.0110.01118.68
8.3.60.0180.00018.43
8.3.50.0220.00917.36
8.3.40.0130.00618.78
8.3.30.0150.00718.76
8.3.20.0040.00420.11
8.3.10.0060.00320.73
8.3.00.0080.00019.23
8.2.290.0110.00721.93
8.2.280.0120.00716.79
8.2.270.0000.01016.80
8.2.260.0110.00716.59
8.2.250.0060.00318.29
8.2.240.0030.00617.28
8.2.230.0050.00522.58
8.2.220.0040.00424.06
8.2.210.0110.00726.77
8.2.200.0000.01018.29
8.2.190.0110.00416.80
8.2.180.0110.01118.43
8.2.170.0110.00422.96
8.2.160.0130.00320.35
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0080.00020.94
8.2.120.0080.00026.16
8.2.110.0060.00322.06
8.2.100.0100.00317.97
8.2.90.0040.00419.35
8.2.80.0000.00818.04
8.2.70.0000.00817.75
8.2.60.0050.00318.04
8.2.50.0000.00818.10
8.2.40.0040.00422.19
8.2.30.0050.00319.30
8.2.20.0040.00418.00
8.2.10.0000.00718.14
8.2.00.0070.00018.14
8.1.330.0090.01322.02
8.1.320.0090.01016.32
8.1.310.0040.00416.54
8.1.300.0000.00916.73
8.1.290.0090.00030.84
8.1.280.0030.01425.92
8.1.270.0040.00422.12
8.1.260.0030.00526.35
8.1.250.0030.00628.09
8.1.240.0030.00623.92
8.1.230.0070.00422.14
8.1.220.0060.00317.91
8.1.210.0040.00418.77
8.1.200.0000.01217.35
8.1.190.0000.00817.35
8.1.180.0000.00918.10
8.1.170.0060.00318.49
8.1.160.0040.00418.89
8.1.150.0000.00718.89
8.1.140.0040.00419.50
8.1.130.0000.00718.77
8.1.120.0000.00717.52
8.1.110.0040.00417.41
8.1.100.0050.00217.39
8.1.90.0000.00817.46
8.1.80.0050.00317.43
8.1.70.0050.00217.53
8.1.60.0000.00817.49
8.1.50.0040.00417.54
8.1.40.0060.00317.47
8.1.30.0030.00517.51
8.1.20.0090.00017.67
8.1.10.0050.00217.59
8.1.00.0000.00717.40
8.0.300.0000.00718.77
8.0.290.0000.00716.75
8.0.280.0000.00718.41
8.0.270.0050.00217.18
8.0.260.0030.00320.80
8.0.250.0030.00316.96
8.0.240.0030.00316.86
8.0.230.0070.00016.96
8.0.220.0030.00316.80
8.0.210.0030.00316.87
8.0.200.0030.00316.98
8.0.190.0060.00316.91
8.0.180.0050.00316.90
8.0.170.0000.00816.91
8.0.160.0040.00416.94
8.0.150.0040.00416.84
8.0.140.0040.00416.85
8.0.130.0000.00613.32
8.0.120.0040.00416.82
8.0.110.0080.00016.78
8.0.100.0000.00716.87
8.0.90.0040.00416.75
8.0.80.0060.01016.78
8.0.70.0000.00716.81
8.0.60.0040.00416.80
8.0.50.0050.00516.78
8.0.30.0090.00916.99
8.0.20.0110.01117.40
8.0.10.0040.00416.85
8.0.00.0120.00616.64
7.4.330.0000.00515.55
7.4.320.0000.00616.60
7.4.300.0000.00816.61
7.4.290.0050.00316.59
7.4.280.0060.00316.44
7.4.270.0000.00616.59
7.4.260.0020.00916.37
7.4.250.0070.00016.48
7.4.240.0040.00416.53
7.4.230.0030.00316.71
7.4.220.0110.00716.51
7.4.210.0090.00616.56
7.4.200.0040.00316.44
7.4.160.0070.01116.36
7.4.150.0000.01917.40
7.4.140.0090.01017.86
7.4.130.0070.01716.57
7.4.120.0070.01416.58
7.4.110.0100.00716.63
7.4.100.0050.01116.41
7.4.90.0110.00816.58
7.4.80.0090.00919.39
7.4.70.0000.01616.35
7.4.60.0130.00316.71
7.4.50.0030.01216.46
7.4.40.0070.01016.49
7.4.30.0090.01316.35
7.4.00.0030.01015.19
7.3.330.0000.00613.25
7.3.320.0030.00313.32
7.3.310.0030.00516.35
7.3.300.0000.00616.16
7.3.290.0080.00716.29
7.3.280.0070.01016.29
7.3.270.0090.00917.40
7.3.260.0090.01216.43
7.3.250.0070.01316.48
7.3.240.0120.00716.42
7.3.230.0140.00416.53
7.3.210.0110.00516.40
7.3.200.0030.01916.26
7.3.190.0040.01216.55
7.3.180.0060.00916.38
7.3.170.0120.01116.51
7.3.160.0060.00916.67
7.3.10.0100.00516.64
7.3.00.0050.00816.75
7.2.330.0100.00716.56
7.2.320.0110.00516.89
7.2.310.0070.01016.80
7.2.300.0090.00616.54
7.2.290.0130.01016.71
7.2.130.0050.00916.85
7.2.120.0140.00116.77
7.2.110.0030.00816.86
7.2.100.0030.00616.85
7.2.90.0080.00516.66
7.2.80.0060.00616.73
7.2.70.0080.00516.86
7.2.60.0070.00816.95
7.2.50.0060.00616.76
7.2.40.0070.00216.72
7.2.30.0070.00616.78
7.2.20.0080.00616.67
7.2.10.0080.00316.84
7.2.00.0090.00216.88
7.1.250.0050.00615.93
7.1.200.0070.00715.78
7.1.70.0100.00317.07
7.1.60.0160.01334.80
7.1.50.0140.01434.48
7.1.40.0170.01034.38
7.1.30.0140.01434.45
7.1.20.0150.01234.74
7.1.10.0030.01016.36
7.1.00.0030.01016.57
7.0.200.0090.00516.72
7.0.190.0030.01016.55
7.0.180.0030.01016.27
7.0.170.0000.01416.16
7.0.160.0080.00516.13
7.0.150.0030.01016.18
7.0.140.0070.00716.21
7.0.130.0030.01216.48
7.0.120.0120.00916.35
7.0.110.0000.01416.38
7.0.100.0080.00816.23
7.0.90.0030.01016.20
7.0.80.0060.01216.14
7.0.70.0040.01116.39
7.0.60.0070.00716.14
7.0.50.0030.01016.42
7.0.40.0050.00816.54
7.0.30.0070.00616.68
7.0.20.0060.00916.63
7.0.10.0060.00916.48
7.0.00.0070.00716.49

preferences:
30.86 ms | 403 KiB | 5 Q