3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Toolset\ChangeSet; /** * Class ChangeSet * * Represents a set of iteratable, countable Changes * * @package ChangeSet */ class ChangeSet implements \Iterator, \ArrayAccess, \Countable { /** * @var Change[] */ protected $changes = array(); /** * @var int Iterator position key */ private $position = 0; /** * Add a Change to the ChangeSet * * @param Change $change * * @throws ChangesetValidationException When a Change response with false to an isValid() call * * @return false When a change with the same id already exists */ public function addChange(Change $change) { if (!$change->isValid()) { throw new ChangeSetValidationException( sprintf("Attempted to add an invalid Change to a ChangeSet. Change: %s", $change) ); } foreach ($this->changes as $changeWeAlreadyHave) { if ($changeWeAlreadyHave->getId() === $change->getId()) { return false; } } $this->changes[] = $change; } /** * Remove a Change from the ChangeSet * * @param Change $change */ public function removeChange(Change $change) { array_walk($this->changes, function($changeToCheck, $key) use ($change) { /** @var Change $changeToCheck */ if ($changeToCheck->getId() === $change->getId()) { unset($this->changes[$key]); } }); } /** * Get changes * * @return Change[] */ public function getChanges() { return $this->changes; } /** * {@inheritdoc} * * @return Change */ public function current() { return $this->changes[$this->position]; } /** * {@inheritdoc} */ public function next() { ++$this->position; } /** * {@inheritdoc} */ public function key() { return $this->position; } /** * {@inheritdoc} */ public function valid() { return isset($this->changes[$this->position]); } /** * {@inheritdoc} */ public function rewind() { $this->position = 0; } /** * {@inheritdoc} */ public function count() { return count($this->changes); } /** * {@inheritdoc} */ public function offsetGet($offset) { return isset($this->changes[$offset]) ? $this->changes[$offset] : null; } /** * {@inheritdoc} */ public function offsetSet($offset, $value) { if (is_null($offset)) { $this->changes[] = $value; } else { $this->changes[$offset] = $value; } } /** * {@inheritdoc} */ public function offsetExists($offset) { return isset($this->changes[$offset]); } /** * {@inheritdoc} */ public function offsetUnset($offset) { unset($this->changes[$offset]); } }

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.5.30.0090.00917.26
8.5.20.0080.00916.74
8.5.10.0100.00720.17
8.5.00.0130.00919.80
8.4.180.0160.00619.55
8.4.170.0130.01423.86
8.4.160.0120.01023.02
8.4.150.0080.00416.87
8.4.140.0130.00817.71
8.4.130.0060.00517.99
8.4.120.0110.00920.70
8.4.110.0120.00822.44
8.4.100.0110.01017.52
8.4.90.0170.00420.65
8.4.80.0110.00818.81
8.4.70.0070.00720.52
8.4.60.0100.01018.92
8.4.50.0110.00922.46
8.4.40.0100.01017.80
8.4.30.0090.01217.54
8.4.20.0100.00717.79
8.4.10.0090.00017.71
8.3.300.0130.00919.04
8.3.290.0120.00920.69
8.3.280.0160.00618.54
8.3.270.0080.01216.70
8.3.260.0090.01116.64
8.3.250.0100.00918.82
8.3.240.0120.00816.85
8.3.230.0130.00616.86
8.3.220.0110.00718.99
8.3.210.0100.00616.79
8.3.200.0030.00616.84
8.3.190.0040.00416.92
8.3.180.0020.00619.04
8.3.170.0070.01016.57
8.3.160.0040.01417.18
8.3.150.0110.00718.96
8.3.140.0000.00820.82
8.3.130.0030.00618.56
8.3.120.0040.00419.01
8.3.110.0040.01120.94
8.3.100.0040.00716.62
8.3.90.0060.00926.77
8.3.80.0060.00616.63
8.3.70.0130.00716.63
8.3.60.0100.00716.63
8.3.50.0070.01421.22
8.3.40.0120.00318.42
8.3.30.0120.00419.04
8.3.20.0080.00020.34
8.3.10.0040.00421.73
8.3.00.0070.00717.38
8.2.300.0120.00820.26
8.2.290.0130.00316.45
8.2.280.0110.00720.10
8.2.270.0040.00718.24
8.2.260.0000.00816.54
8.2.250.0060.00316.62
8.2.240.0100.01017.12
8.2.230.0030.00622.58
8.2.220.0120.00337.54
8.2.210.0040.00426.77
8.2.200.0060.00316.63
8.2.190.0090.00916.63
8.2.180.0120.00625.92
8.2.170.0100.00322.96
8.2.160.0120.00318.79
8.2.150.0030.00625.66
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0070.01119.85
8.2.110.0070.00322.10
8.2.100.0040.00819.25
8.2.90.0000.00819.28
8.2.80.0050.00319.24
8.2.70.0040.00417.38
8.2.60.0040.00417.80
8.2.50.0040.00418.07
8.2.40.0000.00818.09
8.2.30.0070.00017.94
8.2.20.0060.00617.63
8.2.10.0030.00518.07
8.2.00.0040.00418.07
8.1.340.0120.00917.45
8.1.330.0080.01016.00
8.1.320.0070.00316.04
8.1.310.0050.00318.36
8.1.300.0030.00618.05
8.1.290.0040.00430.84
8.1.280.0120.00325.92
8.1.270.0030.00520.20
8.1.260.0000.00726.35
8.1.250.0040.00428.09
8.1.240.0050.00523.82
8.1.230.0050.00519.02
8.1.220.0070.00717.74
8.1.210.0050.00318.77
8.1.200.0030.00616.88
8.1.190.0000.00817.40
8.1.180.0030.00518.89
8.1.170.0000.00818.65
8.1.160.0040.00422.13
8.1.150.0000.00718.90
8.1.140.0070.00017.32
8.1.130.0050.00217.32
8.1.120.0000.00717.41
8.1.110.0030.00517.30
8.1.100.0040.00417.39
8.1.90.0050.00317.41
8.1.80.0000.00717.43
8.1.70.0070.00017.40
8.1.60.0040.00417.45
8.1.50.0060.00317.44
8.1.40.0000.00917.50
8.1.30.0040.00417.67
8.1.20.0050.00317.54
8.1.10.0080.00017.25
8.1.00.0040.00417.34
8.0.300.0040.00418.77
8.0.290.0040.00417.05
8.0.280.0030.00518.36
8.0.270.0000.00717.34
8.0.260.0040.00416.64
8.0.250.0060.00016.90
8.0.240.0070.00016.79
8.0.230.0030.00316.94
8.0.220.0030.00316.84
8.0.210.0030.00616.71
8.0.200.0080.00016.93
8.0.190.0000.00816.83
8.0.180.0070.00016.88
8.0.170.0050.00316.82
8.0.160.0000.00816.89
8.0.150.0020.00516.75
8.0.140.0070.00016.76
8.0.130.0030.00313.32
8.0.120.0000.00816.76
8.0.110.0050.00316.68
8.0.100.0040.00416.84
8.0.90.0000.00816.71
8.0.80.0130.00716.89
8.0.70.0040.00416.91
8.0.60.0000.00716.78
8.0.50.0020.00516.95
8.0.30.0080.01317.15
8.0.20.0120.00817.40
8.0.10.0000.00916.84
8.0.00.0100.00816.60
7.4.330.0050.00015.03
7.4.320.0040.00416.47
7.4.300.0030.00316.46
7.4.290.0000.00616.48
7.4.280.0070.00316.51
7.4.270.0000.00716.57
7.4.260.0030.00316.52
7.4.250.0030.00516.42
7.4.240.0050.00316.40
7.4.230.0050.00216.55
7.4.220.0100.00716.51
7.4.210.0100.00416.63
7.4.200.0040.00416.36
7.4.160.0100.00616.57
7.4.150.0080.00817.40
7.4.140.0100.00917.86
7.4.130.0090.01116.59
7.4.120.0080.01116.44
7.4.110.0180.00316.34
7.4.100.0140.00416.46
7.4.90.0150.00316.54
7.4.80.0100.01419.39
7.4.70.0100.00716.41
7.4.60.0120.00316.44
7.4.50.0030.00516.27
7.4.40.0070.01016.54
7.4.30.0070.01716.47
7.4.00.0070.00714.66
7.3.330.0070.00013.20
7.3.320.0020.00513.13
7.3.310.0040.00416.02
7.3.300.0070.00016.24
7.3.290.0080.00616.21
7.3.280.0070.01016.23
7.3.270.0040.01217.40
7.3.260.0110.00716.44
7.3.250.0090.00916.21
7.3.240.0140.00716.55
7.3.230.0090.00916.41
7.3.210.0130.01016.40
7.3.200.0060.01219.39
7.3.190.0130.00316.21
7.3.180.0090.00616.39
7.3.170.0090.00916.29
7.3.160.0090.00916.42
7.3.120.0000.01614.42
7.3.110.0150.00614.77
7.3.100.0040.01114.68
7.3.90.0100.00614.69
7.3.80.0000.01314.93
7.3.70.0060.00314.77
7.3.60.0030.01314.82
7.3.50.0000.01414.74
7.3.40.0030.01214.76
7.3.30.0070.01014.78
7.3.20.0060.00916.40
7.3.10.0070.00816.24
7.3.00.0110.00316.58
7.2.330.0120.00716.38
7.2.320.0100.01316.70
7.2.310.0060.01316.63
7.2.300.0070.01016.31
7.2.290.0040.01216.42
7.2.250.0070.01314.98
7.2.240.0080.01114.77
7.2.230.0060.00914.90
7.2.220.0000.01514.87
7.2.210.0100.00314.68
7.2.200.0030.01014.80
7.2.190.0060.00914.86
7.2.180.0100.00914.86
7.2.170.0030.00914.90
7.2.130.0000.01016.72
7.2.120.0030.00716.21
7.2.110.0080.00416.39
7.2.100.0000.01416.47
7.2.90.0110.00316.32
7.2.80.0000.01316.45
7.2.70.0120.00416.34
7.2.60.0030.01016.34
7.2.50.0000.01216.36
7.2.40.0150.00316.73
7.2.30.0090.00916.44
7.2.20.0070.01016.68
7.2.10.0110.00416.47
7.2.00.0040.01317.98
7.1.330.0100.00315.52
7.1.320.0090.00015.56
7.1.310.0060.00815.86
7.1.300.0070.01115.84
7.1.290.0060.00315.55
7.1.280.0040.01415.67
7.1.270.0030.01315.81
7.1.260.0100.00315.40
7.1.250.0030.00915.46
7.1.100.0100.00317.80
7.1.70.0080.00316.90
7.1.60.0070.01819.50
7.1.50.0100.01416.53
7.1.00.0070.07322.46
7.0.200.0060.00616.70
7.0.60.0030.04020.00
7.0.50.0030.04317.95
7.0.40.0070.08320.27
7.0.30.0200.05320.08
7.0.20.0270.05320.28
7.0.10.0100.08320.20
7.0.00.0030.04020.22
5.6.280.0000.07721.16
5.6.210.0070.08320.73
5.6.200.0030.04018.19
5.6.190.0100.05320.52
5.6.180.0300.03720.58
5.6.170.0300.04720.46
5.6.160.0100.08020.55
5.6.150.0000.08718.28
5.6.140.0100.04718.27
5.6.130.0100.08318.16
5.6.120.0170.08020.81
5.6.110.0030.05021.04
5.6.100.0070.08721.02
5.6.90.0100.07321.05
5.6.80.0130.07320.54
5.5.350.0200.06320.46
5.5.340.0030.04718.07
5.5.330.0170.06720.26
5.5.320.0370.07320.25
5.5.310.0170.06720.35
5.5.300.0100.07017.97
5.5.290.0130.08018.04
5.5.280.0030.04720.82
5.5.270.0070.03720.89
5.5.260.0130.06320.81
5.5.250.0030.05720.74
5.5.240.0300.07020.18
5.4.450.0930.04719.32
5.4.440.0170.03719.58
5.4.430.0630.03019.38
5.4.420.0070.08019.21
5.4.410.0130.05018.72
5.4.400.0030.06318.68
5.4.390.0170.05318.76
5.4.380.0130.05018.81
5.4.370.0100.05718.57
5.4.360.0170.05018.75
5.4.350.0200.04718.47
5.4.340.0170.07718.76
5.4.320.0070.06318.76
5.4.310.0000.06318.46
5.4.300.0030.06318.77
5.4.290.0130.05018.62
5.4.280.0100.05718.52
5.4.270.0070.06018.71
5.4.260.0100.05718.45
5.4.250.0130.05318.72
5.4.240.0100.05718.46
5.4.230.0130.05018.58
5.4.220.0230.04318.56
5.4.210.0170.05318.56
5.4.200.0130.05016.68
5.4.190.0100.05318.51
5.4.180.0200.04718.72
5.4.170.0170.05718.72
5.4.160.0070.07718.71
5.4.150.0200.06318.75
5.4.140.0030.06316.44
5.4.130.0070.05316.24
5.4.120.0230.05016.26
5.4.110.0230.05716.43
5.4.100.0130.05316.16
5.4.90.0270.04316.41
5.4.80.0130.05316.32
5.4.70.0130.05016.31
5.4.60.0130.05716.30
5.4.50.0000.06016.20
5.4.40.0030.05716.21
5.4.30.0030.05716.25
5.4.20.0130.07016.23
5.4.10.0170.05016.15
5.4.00.0170.04315.90
5.3.290.0130.05314.98
5.3.280.0070.06014.67
5.3.270.0070.06014.68
5.3.260.0030.06714.84
5.3.250.0100.05714.73
5.3.240.0030.06014.76
5.3.230.0100.05314.71
5.3.220.0100.05014.59
5.3.210.0100.05314.89
5.3.200.0130.06714.64
5.3.190.0030.06014.59
5.3.180.0100.06714.79
5.3.170.0130.05714.62
5.3.160.0200.06714.79
5.3.150.0130.07314.68
5.3.140.0170.04714.63
5.3.130.0230.04314.77
5.3.120.0030.06014.61
5.3.110.0070.05714.86
5.3.100.0100.06014.10
5.3.90.0030.05714.14
5.3.80.0030.05714.19
5.3.70.0100.05014.14
5.3.60.0070.05714.08
5.3.50.0070.05714.26
5.3.40.0170.04314.14
5.3.30.0100.05013.98
5.3.20.0100.05013.73
5.3.10.0170.04313.67
5.3.00.0130.05713.78
5.2.170.0170.04311.20
5.2.160.0070.05011.13
5.2.150.0170.05011.12
5.2.140.0070.04711.13
5.2.130.0130.04711.17
5.2.120.0170.03311.07
5.2.110.0130.03711.06
5.2.100.0130.03311.11
5.2.90.0070.04311.04
5.2.80.0130.05311.03
5.2.70.0170.05011.13
5.2.60.0070.06011.11
5.2.50.0130.03711.02
5.2.40.0100.04711.14
5.2.30.0130.03711.12
5.2.20.0070.04010.92
5.2.10.0130.03310.91
5.2.00.0100.04010.73
5.1.60.0130.03310.09
5.1.50.0000.05310.01
5.1.40.0100.04010.04
5.1.30.0070.03710.39
5.1.20.0070.04010.36
5.1.10.0070.03710.21
5.1.00.0100.03310.10
5.0.50.0070.0278.57
5.0.40.0200.0338.41
5.0.30.0070.0438.36
5.0.20.0030.0308.21
5.0.10.0100.0238.19
5.0.00.0070.0408.18
4.4.90.0100.0175.88
4.4.80.0030.0235.93
4.4.70.0000.0235.86
4.4.60.0000.0235.82
4.4.50.0070.0235.91
4.4.40.0100.0305.93
4.4.30.0030.0205.82
4.4.20.0030.0235.97
4.4.10.0000.0235.98
4.4.00.0030.0375.90
4.3.110.0100.0175.84
4.3.100.0000.0275.79
4.3.90.0070.0175.82
4.3.80.0070.0305.82
4.3.70.0070.0235.77
4.3.60.0070.0205.91
4.3.50.0030.0235.87
4.3.40.0000.0375.78
4.3.30.0000.0304.57
4.3.20.0070.0174.54
4.3.10.0030.0274.47
4.3.00.0030.01715.65

preferences:
59.44 ms | 2498 KiB | 5 Q