3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyModel { } class Collection implements \ArrayAccess, \Iterator { private $storage = array(); public function offsetExists($offset) { return isset($this->storage[$offset]); } public function offsetGet($offset) { return $this->storage[$offset]; } public function offsetSet($offset, $value) { if (null === $offset) { $this->storage[] = $value; } else { $this->storage[$offset] = $value; } } public function offsetUnset($offset) { unset ($this->storage[$offset]); } public function current() { return current($this->storage); } public function next() { return next($this->storage); } public function key() { return key($this->storage); } public function valid() { return key($this->storage) !== null; } public function rewind() { reset($this->storage); } public function count() { return count($this->storage); } } class MyCollectionModel { private $collection; public function __construct() { $this->collection = new Collection(); } public function addElement($element) { $this->collection[] = $element; } public function removeMyModels() { foreach ($this->collection as $index => $value) { if ($value instanceof MyModel) { unset ($this->collection[$index]); } } } } // Создем коллекцию $myCollection = new MyCollectionModel(); // Заполняем своими можельками for ($i = 0; $i < 10; $i++) { $myCollection->addElement(new MyModel()); } // Удаляем свои модельки $myCollection->removeMyModels(); // Сука, ебучая PHP!!! print_r($myCollection);

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.0170.00318.68
8.3.50.0090.01321.92
8.3.40.0110.00418.96
8.3.30.0040.01119.26
8.3.20.0040.00420.33
8.3.10.0050.00320.53
8.3.00.0050.00319.81
8.2.180.0110.00416.75
8.2.170.0140.00722.96
8.2.160.0030.01020.52
8.2.150.0020.00524.18
8.2.140.0040.01224.66
8.2.130.0000.00826.16
8.2.120.0080.00022.14
8.2.110.0060.00322.25
8.2.100.0000.01217.84
8.2.90.0000.00819.35
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0090.00317.80
8.2.50.0050.00318.07
8.2.40.0000.00918.16
8.2.30.0020.00519.32
8.2.20.0000.00917.80
8.2.10.0030.00618.12
8.2.00.0040.00417.86
8.1.280.0120.00625.92
8.1.270.0000.00822.14
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.98
8.1.230.0100.00319.00
8.1.220.0040.00417.74
8.1.210.0050.00318.77
8.1.200.0030.00617.36
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0060.00318.45
8.1.160.0000.00722.03
8.1.150.0070.00018.87
8.1.140.0050.00317.38
8.1.130.0030.00317.78
8.1.120.0000.00817.45
8.1.110.0040.00417.44
8.1.100.0040.00317.49
8.1.90.0040.00417.49
8.1.80.0070.00017.36
8.1.70.0000.00717.48
8.1.60.0000.00817.55
8.1.50.0080.00017.43
8.1.40.0030.00517.58
8.1.30.0040.00417.67
8.1.20.0050.00317.54
8.1.10.0000.00817.49
8.1.00.0060.00617.41
8.0.300.0050.00318.77
8.0.290.0040.00416.63
8.0.280.0000.00718.37
8.0.270.0040.00417.35
8.0.260.0000.00717.18
8.0.250.0000.00616.91
8.0.240.0030.00316.89
8.0.230.0030.00316.97
8.0.220.0070.00016.75
8.0.210.0030.00316.90
8.0.200.0040.00416.96
8.0.190.0000.01116.92
8.0.180.0040.00416.98
8.0.170.0000.00716.94
8.0.160.0070.00016.80
8.0.150.0040.00316.86
8.0.140.0040.00416.79
8.0.130.0000.00513.32
8.0.120.0000.00816.92
8.0.110.0040.00416.93
8.0.100.0000.00716.79
8.0.90.0000.00716.84
8.0.80.0110.00816.88
8.0.70.0000.00716.78
8.0.60.0080.00016.86
8.0.50.0070.00016.96
8.0.30.0050.01417.10
8.0.20.0130.00717.40
8.0.10.0020.00517.06
8.0.00.0090.01016.79
7.4.330.0020.00215.14
7.4.320.0060.00016.60
7.4.300.0030.00316.41
7.4.290.0000.00616.47
7.4.280.0000.00816.59
7.4.270.0000.00716.52
7.4.260.0030.00316.50
7.4.250.0000.00716.46
7.4.240.0010.00616.46
7.4.230.0040.00416.61
7.4.220.0130.00316.71
7.4.210.0060.00916.63
7.4.200.0050.00216.70
7.4.160.0000.02016.71
7.4.150.0070.01717.40
7.4.140.0090.01117.86
7.4.130.0130.00516.52
7.4.120.0070.01416.47
7.4.110.0060.01016.39
7.4.100.0130.00616.57
7.4.90.0090.00816.43
7.4.80.0110.01516.55
7.4.70.0060.01116.50
7.4.60.0090.00616.51
7.4.50.0040.00416.34
7.4.40.0170.00016.52
7.4.30.0130.00316.54
7.4.00.0090.00814.89
7.3.330.0050.00013.24
7.3.320.0050.00013.31
7.3.310.0030.00316.17
7.3.300.0000.00716.24
7.3.290.0070.00716.37
7.3.280.0060.01016.35
7.3.270.0130.01017.40
7.3.260.0160.00616.27
7.3.250.0100.00716.42
7.3.240.0110.00916.57
7.3.230.0100.00716.41
7.3.210.0100.00716.36
7.3.200.0070.01419.39
7.3.190.0110.00616.71
7.3.180.0080.00816.46
7.3.170.0100.00716.54
7.3.160.0160.00616.54
7.3.120.0070.01215.12
7.3.110.0070.00715.03
7.3.100.0020.00914.69
7.3.90.0050.01014.80
7.3.80.0090.00514.79
7.3.70.0100.00614.89
7.3.60.0020.01014.97
7.3.50.0110.00514.86
7.3.40.0060.00914.90
7.3.30.0050.01014.72
7.3.20.0060.00616.50
7.3.10.0100.00316.58
7.3.00.0040.01116.74
7.2.330.0060.01116.67
7.2.320.0090.00916.75
7.2.310.0060.01116.82
7.2.300.0030.01516.86
7.2.290.0030.01416.59
7.2.250.0090.00915.09
7.2.240.0080.01115.05
7.2.230.0050.01115.27
7.2.220.0090.00715.14
7.2.210.0060.00615.17
7.2.200.0050.01215.09
7.2.190.0070.00914.99
7.2.180.0070.00914.96
7.2.170.0050.00815.15
7.2.110.0710.00716.60
7.2.60.0030.00617.02
7.2.00.0000.01119.11
7.1.330.0060.00715.69
7.1.320.0040.00715.63
7.1.310.0080.00615.81
7.1.300.0120.00215.86
7.1.290.0060.00615.81
7.1.280.0030.01015.69
7.1.270.0040.00615.71
7.1.260.0040.00915.71
7.1.200.0060.00615.76
7.1.100.0060.00618.18
7.1.70.0040.00417.29
7.1.60.0140.01019.32
7.1.50.0110.01517.02
7.1.00.0130.06722.40
7.0.200.0080.00316.46
7.0.140.0030.07322.08
7.0.60.0130.08019.94
7.0.50.0070.08017.89
7.0.40.0070.09020.24
7.0.30.0270.05020.24
7.0.20.0230.07720.24
7.0.10.0030.06020.10
7.0.00.0000.05020.22
5.6.280.0100.06720.94
5.6.210.0070.08320.49
5.6.200.0030.04018.18
5.6.190.0070.04020.63
5.6.180.0470.07720.46
5.6.170.0170.07720.49
5.6.160.0070.07020.47
5.6.150.0100.06018.27
5.6.140.0070.06718.23
5.6.130.0070.09018.17
5.6.120.0030.07020.94
5.6.110.0100.07321.00
5.6.100.0070.04721.14
5.6.90.0000.06720.98
5.6.80.0100.06020.54
5.5.350.0200.07720.45
5.5.340.0030.04717.94
5.5.330.0000.04320.41
5.5.320.0370.06020.51
5.5.310.0230.08020.30
5.5.300.0070.03717.98
5.5.290.0070.07017.96
5.5.280.0070.03720.79
5.5.270.0000.06020.91
5.5.260.0070.08320.88
5.5.250.0100.06320.50
5.5.240.0100.08020.08
5.4.450.0400.05719.21
5.4.440.0370.05019.61
5.4.430.0230.04719.16
5.4.420.0630.06319.54
5.4.410.0830.07019.26
5.4.400.0230.04019.29
5.4.390.0930.06019.38
5.4.380.0530.07018.63
5.4.370.0400.07718.75
5.4.360.0430.06318.52
5.4.350.0470.06718.71
5.4.340.0400.05018.48
5.4.320.0050.04512.52
5.4.310.0080.03512.52
5.4.300.0090.03212.52
5.4.290.0040.04612.51
5.4.280.0080.03212.41
5.4.270.0070.03412.41
5.4.260.0070.03512.41
5.4.250.0050.03712.41
5.4.240.0100.03112.41
5.4.230.0060.03712.40
5.4.220.0090.03712.41
5.4.210.0070.03712.41
5.4.200.0060.04212.40
5.4.190.0050.03712.39
5.4.180.0050.03712.40
5.4.170.0070.03412.41
5.4.160.0060.04112.40
5.4.150.0030.04012.40
5.4.140.0070.04112.08
5.4.130.0080.03512.07
5.4.120.0050.03512.03
5.4.110.0040.03612.02
5.4.100.0110.02912.02
5.4.90.0060.04612.02
5.4.80.0070.04012.02
5.4.70.0050.03812.02
5.4.60.0050.04212.02
5.4.50.0040.03712.02
5.4.40.0090.03112.01
5.4.30.0060.03512.01
5.4.20.0060.03512.00
5.4.10.0090.03512.00
5.4.00.0060.03911.49
5.3.290.0070.03712.80
5.3.280.0050.03712.71
5.3.270.0080.04012.73
5.3.260.0040.04112.73
5.3.250.0060.03712.72
5.3.240.0050.03712.72
5.3.230.0080.03512.71
5.3.220.0060.03612.68
5.3.210.0060.03812.69
5.3.200.0070.04112.68
5.3.190.0040.04012.68
5.3.180.0050.04112.68
5.3.170.0050.04212.68
5.3.160.0060.04312.68
5.3.150.0070.03512.69
5.3.140.0070.04012.67
5.3.130.0070.04212.67
5.3.120.0070.03612.67
5.3.110.0090.03812.66
5.3.100.0050.03712.16
5.3.90.0070.04212.14
5.3.80.0060.03412.13
5.3.70.0060.03512.13
5.3.60.0040.03712.11
5.3.50.0050.03612.06
5.3.40.0090.03812.05
5.3.30.0070.03612.02
5.3.20.0050.03611.80
5.3.10.0020.04511.77
5.3.00.0080.03911.75
5.2.170.0060.0329.25
5.2.160.0040.0309.25
5.2.150.0040.0319.25
5.2.140.0110.0339.24
5.2.130.0050.0299.21
5.2.120.0030.0299.20
5.2.110.0070.0269.21
5.2.100.0040.0369.21
5.2.90.0030.0349.20
5.2.80.0040.0319.20
5.2.70.0060.0339.20
5.2.60.0040.0309.16
5.2.50.0050.0309.12
5.2.40.0050.0319.10
5.2.30.0040.0319.07
5.2.20.0050.0289.07
5.2.10.0050.0278.97
5.2.00.0050.0288.84
5.1.60.0070.0218.12
5.1.50.0080.0208.12
5.1.40.0030.0268.10
5.1.30.0050.0268.45
5.1.20.0050.0258.46
5.1.10.0050.0248.19
5.1.00.0050.0248.19
5.0.50.0030.0216.67
5.0.40.0040.0296.53
5.0.30.0040.0326.35
5.0.20.0050.0246.31
5.0.10.0050.0186.29
5.0.00.0010.0326.28
4.4.90.0010.0164.78
4.4.80.0020.0154.75
4.4.70.0020.0154.75
4.4.60.0020.0154.76
4.4.50.0020.0224.77
4.4.40.0010.0274.71
4.4.30.0030.0144.76
4.4.20.0060.0164.84
4.4.10.0010.0204.85
4.4.00.0010.0284.76
4.3.110.0040.0194.67
4.3.100.0030.0144.67
4.3.90.0010.0164.63
4.3.80.0010.0274.58
4.3.70.0010.0154.63
4.3.60.0020.0154.63
4.3.50.0030.0154.63
4.3.40.0030.0244.53
4.3.30.0040.0143.30
4.3.20.0040.0173.28
4.3.10.0020.0153.23
4.3.00.0030.0206.73

preferences:
37.28 ms | 401 KiB | 5 Q