3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Behaves like a PHP array (unstructured) */ class Bag implements IteratorAggregate, ArrayAccess { private $__data; // Implementation for ArrayAccess public function offsetSet($offset, $value) { if (is_null($offset)) { $this->__data[] = value; } else { $this->__data[$offset] = $value; } } public function offsetExists($offset) { return isset($this->__data[$offset]); } public function offsetUnset($offset) { unset($this->__data[$offset]); } public function offsetGet($offset) { return isset($this->__data[$offset]) ? $this->__data[$offset] : null; } // Implementation for IteratorAggregate public function getIterator() { return new ArrayIterator($this->__data); } public function __construct(array $data) { $this->__data = $data; } public function some(Closure $fn) { return new Bag(array_reduce($this->__data, function ($carry, $x) { return $fn($x) || $carry; }, false)); } public function every(Closure $fn) { return new Bag(array_reduce($this->__data, function ($carry, $x) { return $fn($x) && $carry; }, true)); } public function reduce(Closure $fn) { return new Bag(array_reduce($this->__data, $fn)); } public function map(Closure $fn) { return new Bag(array_map($fn, $this->__data)); } public function filter(Closure $fn) { return new Bag(array_filter($this->__data, $fn)); } }

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.3.60.0150.00018.68
8.3.50.0160.00521.91
8.3.40.0110.00718.71
8.3.30.0070.00719.04
8.3.20.0040.00420.51
8.3.10.0040.00421.85
8.3.00.0050.00319.26
8.2.180.0000.01616.63
8.2.170.0070.01022.96
8.2.160.0100.00322.26
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0000.00819.56
8.2.110.0090.00022.12
8.2.100.0040.00819.32
8.2.90.0040.00419.17
8.2.80.0000.00817.97
8.2.70.0000.00817.38
8.2.60.0040.00417.80
8.2.50.0030.00518.07
8.2.40.0050.00319.76
8.2.30.0030.00518.09
8.2.20.0000.00717.57
8.2.10.0050.00318.01
8.2.00.0000.00817.57
8.1.280.0110.00425.92
8.1.270.0090.00018.79
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00623.83
8.1.230.0060.00619.08
8.1.220.0060.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00617.23
8.1.190.0030.00517.10
8.1.180.0040.00418.10
8.1.170.0050.00318.64
8.1.160.0040.00422.01
8.1.150.0050.00318.82
8.1.140.0090.00017.43
8.1.130.0000.00717.85
8.1.120.0050.00217.43
8.1.110.0000.00817.41
8.1.100.0050.00217.30
8.1.90.0070.00017.42
8.1.80.0000.00717.38
8.1.70.0030.00317.34
8.1.60.0060.00317.46
8.1.50.0000.00817.42
8.1.40.0040.00417.48
8.1.30.0000.00817.56
8.1.20.0040.00417.60
8.1.10.0040.00417.40
8.1.00.0050.00317.20
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0070.00018.42
8.0.270.0000.00716.71
8.0.260.0000.00617.24
8.0.250.0030.00316.87
8.0.240.0030.00616.94
8.0.230.0000.00716.91
8.0.220.0030.00316.92
8.0.210.0030.00316.78
8.0.200.0000.00616.91
8.0.190.0090.00016.93
8.0.180.0030.00316.83
8.0.170.0040.00416.89
8.0.160.0000.00816.88
8.0.150.0000.00816.87
8.0.140.0000.00716.88
8.0.130.0030.00313.25
8.0.120.0080.00016.87
8.0.110.0000.00816.86
8.0.100.0040.00416.77
8.0.90.0050.00316.84
8.0.80.0030.01216.80
8.0.70.0050.00316.90
8.0.60.0000.00716.66
8.0.50.0000.00816.89
8.0.30.0180.00816.91
8.0.20.0060.01217.40
8.0.10.0000.00816.99
8.0.00.0110.01116.69
7.4.330.0070.00015.03
7.4.320.0050.00316.48
7.4.300.0030.00316.37
7.4.290.0070.00016.45
7.4.280.0050.00216.56
7.4.270.0030.00716.59
7.4.260.0060.00316.60
7.4.250.0000.00716.48
7.4.240.0020.00516.44
7.4.230.0030.00316.67
7.4.220.0110.01216.44
7.4.210.0130.00716.43
7.4.200.0040.00416.32
7.4.160.0140.00316.42
7.4.150.0120.00617.40
7.4.140.0080.01017.86
7.4.130.0090.00816.37
7.4.120.0070.01016.49
7.4.110.0100.01316.28
7.4.100.0090.00916.51
7.4.90.0030.01416.29
7.4.80.0130.01019.39
7.4.70.0090.01216.48
7.4.60.0090.00916.32
7.4.50.0050.00316.62
7.4.40.0070.01016.43
7.4.30.0070.01016.47
7.4.00.0070.00714.71
7.3.330.0050.00013.14
7.3.320.0060.00013.01
7.3.310.0070.00016.22
7.3.300.0030.00316.04
7.3.290.0070.00816.17
7.3.280.0050.01216.16
7.3.270.0120.00617.40
7.3.260.0170.00016.39
7.3.250.0130.00816.26
7.3.240.0110.00616.44
7.3.230.0100.00616.40
7.3.210.0110.00616.13
7.3.200.0090.00919.39
7.3.190.0030.01316.23
7.3.180.0090.01316.54
7.3.170.0130.00316.44
7.3.160.0200.00316.33
7.2.330.0090.00916.59
7.2.320.0070.01116.33
7.2.310.0000.01516.27
7.2.300.0170.00716.66
7.2.290.0090.01616.47
7.2.00.0000.01518.95
7.1.200.0060.00615.76
7.1.100.0060.01217.88
7.1.70.0090.00917.07
7.1.60.0060.01919.22
7.1.50.0250.00734.75
7.1.00.0030.07722.57
7.0.200.0070.01016.39
7.0.140.0030.04722.05
7.0.60.0030.04020.05
7.0.50.0170.07317.86
7.0.40.0070.04320.30
7.0.30.0530.05720.20
7.0.20.0230.08020.16
7.0.10.0130.05320.10
7.0.00.0100.07320.23
5.6.280.0100.06720.95
5.6.210.0130.07320.63
5.6.200.0000.07318.29
5.6.190.0130.08020.41
5.6.180.0270.07720.64
5.6.170.0430.07020.40
5.6.160.0100.08020.62
5.6.150.0070.08018.21
5.6.140.0100.05018.14
5.6.130.0100.07718.15
5.6.120.0030.05021.07
5.6.110.0030.07321.03
5.6.100.0130.08021.15
5.6.90.0130.03321.14
5.6.80.0030.08720.48
5.6.70.0100.07320.41
5.5.350.0000.07320.52
5.5.340.0070.06318.05
5.5.330.0030.04720.47
5.5.320.0270.08020.36
5.5.310.0330.04720.24
5.5.300.0000.06718.05
5.5.290.0000.04318.09
5.5.280.0070.04020.80
5.5.270.0070.04020.91
5.5.260.0170.07320.89
5.5.250.0170.07320.71
5.5.240.0000.07720.26
5.4.450.0500.06019.48
5.4.440.0500.05019.58
5.4.430.0700.06019.54
5.4.420.0830.05019.19
5.4.410.0170.05019.17
5.4.400.0870.04719.14
5.4.390.1000.06719.27
5.4.380.0300.05318.59
5.4.370.0170.06018.59
5.4.360.0300.04718.61
5.4.350.0230.05018.76
5.4.340.0270.04318.52
5.4.320.0230.05018.79
5.4.310.0230.04718.59
5.4.300.0270.05318.61
5.4.290.0330.03718.54
5.4.280.0330.05018.59
5.4.270.0200.05318.76
5.4.260.0230.05018.50
5.4.250.0130.06018.59
5.4.240.0270.05018.75
5.4.230.0200.05718.48
5.4.220.0230.05018.72
5.4.210.0070.06718.69
5.4.200.0200.04716.70
5.4.190.0170.05318.57
5.4.180.0230.04718.75
5.4.170.0200.05318.73
5.4.160.0230.04718.79
5.4.150.0170.05718.54
5.4.140.0200.05016.16
5.4.130.0270.04016.28
5.4.120.0200.06316.25
5.4.110.0170.05016.30
5.4.100.0230.05316.29
5.4.90.0200.06016.29
5.4.80.0130.05316.30
5.4.70.0230.06016.28
5.4.60.0070.06016.42
5.4.50.0170.05316.28
5.4.40.0230.04716.32
5.4.30.0200.04316.26
5.4.20.0200.05016.19
5.4.10.0170.05016.28
5.4.00.0200.06315.79
5.3.290.0230.05014.81
5.3.280.0230.05014.73
5.3.270.0100.06014.80
5.3.260.0230.05014.63
5.3.250.0100.06014.81
5.3.240.0230.05714.77
5.3.230.0230.04714.84
5.3.220.0300.05314.70
5.3.210.0230.05014.66
5.3.200.0170.05314.70
5.3.190.0270.04314.60
5.3.180.0170.05314.70
5.3.170.0200.04714.62
5.3.160.0130.05314.64
5.3.150.0200.05014.70
5.3.140.0300.03714.63
5.3.130.0270.04314.61
5.3.120.0130.05714.81
5.3.110.0100.06314.71
5.3.100.0200.05014.25
5.3.90.0170.05014.24
5.3.80.0130.05314.18
5.3.70.0130.05314.17
5.3.60.0100.06014.26
5.3.50.0270.04314.11
5.3.40.0170.05314.14
5.3.30.0330.06014.06
5.3.20.0230.04713.75
5.3.10.0270.05713.82
5.3.00.0130.05713.77
5.2.170.0200.03711.38
5.2.160.0230.03311.21
5.2.150.0170.05011.29
5.2.140.0170.04711.18
5.2.130.0100.04311.19
5.2.120.0130.05311.17
5.2.110.0130.04011.23
5.2.100.0070.04311.21
5.2.90.0130.04011.24
5.2.80.0200.04011.13
5.2.70.0200.05311.09
5.2.60.0230.05011.19
5.2.50.0130.05311.03
5.2.40.0070.04311.12
5.2.30.0100.04011.20
5.2.20.0230.02711.08
5.2.10.0170.04710.86
5.2.00.0230.03010.77
5.1.60.0170.03010.01
5.1.50.0070.04310.00
5.1.40.0100.05010.00
5.1.30.0070.04010.36
5.1.20.0100.04010.59
5.1.10.0100.03710.13
5.1.00.0130.03310.17
5.0.50.0070.0338.59
5.0.40.0030.0308.62
5.0.30.0030.0478.25
5.0.20.0130.0238.42
5.0.10.0100.0278.19
5.0.00.0100.0408.20
4.4.90.0070.0207.20
4.4.80.0100.0177.20
4.4.70.0070.0207.20
4.4.60.0030.0237.20
4.4.50.0100.0177.20
4.4.40.0070.0337.20
4.4.30.0030.0237.20
4.4.20.0030.0277.20
4.4.10.0070.0207.20
4.4.00.0070.0337.20
4.3.110.0000.0277.20
4.3.100.0130.0137.20
4.3.90.0130.0137.20
4.3.80.0030.0377.20
4.3.70.0100.0177.20
4.3.60.0030.0237.20
4.3.50.0030.0237.20
4.3.40.0070.0337.20
4.3.30.0070.0207.20
4.3.20.0100.0237.20
4.3.10.0000.0277.20
4.3.00.0100.0237.63

preferences:
51.61 ms | 401 KiB | 5 Q