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) { echo 'trying to unset ' . $offset . PHP_EOL; unset($this->storage[$offset]); reset($this->storage); } 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) { var_dump($index); 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.0090.00918.48
8.3.50.0090.01221.92
8.3.40.0160.00018.80
8.3.30.0030.01019.21
8.3.20.0050.00320.16
8.3.10.0000.00820.70
8.3.00.0040.00419.68
8.2.180.0060.00916.63
8.2.170.0090.00622.96
8.2.160.0060.01320.27
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0000.00822.19
8.2.110.0000.00922.20
8.2.100.0080.00417.91
8.2.90.0030.00617.88
8.2.80.0000.00818.05
8.2.70.0000.00817.80
8.2.60.0040.00417.93
8.2.50.0060.00618.10
8.2.40.0060.00320.60
8.2.30.0030.00519.26
8.2.20.0050.00317.77
8.2.10.0030.00518.13
8.2.00.0030.00517.71
8.1.280.0070.01425.92
8.1.270.0000.00824.02
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0110.00720.75
8.1.230.0110.00019.15
8.1.220.0060.00317.89
8.1.210.0050.00318.77
8.1.200.0040.00417.36
8.1.190.0030.00517.23
8.1.180.0050.00318.10
8.1.170.0000.00818.64
8.1.160.0040.00421.93
8.1.150.0040.00418.88
8.1.140.0050.00317.46
8.1.130.0000.00817.85
8.1.120.0000.00717.51
8.1.110.0040.00417.42
8.1.100.0000.00717.44
8.1.90.0000.00717.51
8.1.80.0040.00317.41
8.1.70.0000.00717.40
8.1.60.0060.00317.56
8.1.50.0000.00917.56
8.1.40.0080.00017.51
8.1.30.0030.00517.54
8.1.20.0040.00417.60
8.1.10.0030.00617.57
8.1.00.0080.00417.57
8.0.300.0040.00419.66
8.0.290.0080.00016.58
8.0.280.0040.00418.37
8.0.270.0000.00717.38
8.0.260.0040.00417.19
8.0.250.0070.00017.00
8.0.240.0060.00016.98
8.0.230.0040.00416.87
8.0.220.0000.00716.91
8.0.210.0070.00016.81
8.0.200.0080.00016.98
8.0.190.0060.00316.88
8.0.180.0000.00716.94
8.0.170.0000.00916.95
8.0.160.0050.00216.93
8.0.150.0000.00816.73
8.0.140.0000.00716.82
8.0.130.0000.00713.39
8.0.120.0040.00416.88
8.0.110.0050.00316.91
8.0.100.0040.00416.86
8.0.90.0040.00416.94
8.0.80.0070.01116.93
8.0.70.0000.00716.85
8.0.60.0040.00416.84
8.0.50.0000.00816.96
8.0.30.0140.00917.16
8.0.20.0080.01317.40
8.0.10.0000.00817.05
8.0.00.0070.01016.80
7.4.330.0030.00315.14
7.4.320.0030.00316.41
7.4.300.0030.00316.37
7.4.290.0070.00016.50
7.4.280.0040.00416.46
7.4.270.0030.00316.47
7.4.260.0000.00716.47
7.4.250.0000.00716.61
7.4.240.0040.00316.49
7.4.230.0040.00416.68
7.4.220.0060.01216.46
7.4.210.0100.00316.50
7.4.200.0080.00016.40
7.4.160.0060.01116.56
7.4.150.0100.01617.40
7.4.140.0130.00717.86
7.4.130.0090.00916.55
7.4.120.0060.01116.48
7.4.110.0140.00616.65
7.4.100.0000.02016.56
7.4.90.0070.01016.54
7.4.80.0060.01316.63
7.4.70.0030.01916.55
7.4.60.0080.00716.66
7.4.50.0060.00316.29
7.4.40.0070.01016.39
7.4.30.0000.02216.62
7.4.00.0080.00714.86
7.3.330.0000.00513.34
7.3.320.0030.00313.39
7.3.310.0000.00816.41
7.3.300.0050.00216.32
7.3.290.0110.00316.34
7.3.280.0070.00816.37
7.3.270.0120.00617.40
7.3.260.0060.01216.41
7.3.250.0150.00516.48
7.3.240.0150.01216.42
7.3.230.0070.01016.39
7.3.210.0100.00916.53
7.3.200.0130.00719.39
7.3.190.0030.01416.43
7.3.180.0160.00016.61
7.3.170.0070.01016.45
7.3.160.0060.01016.67
7.3.120.0100.00516.10
7.3.110.0050.01115.95
7.3.100.0100.00515.95
7.3.90.0020.01216.15
7.3.80.0040.01116.00
7.3.70.0090.00715.95
7.3.60.0030.01015.83
7.3.50.0060.00716.02
7.3.40.0080.00815.97
7.3.30.0040.01216.00
7.3.20.0080.00616.83
7.3.10.0090.00516.98
7.3.00.0040.01117.04
7.2.330.0150.00316.90
7.2.320.0180.00916.51
7.2.310.0070.01016.66
7.2.300.0060.01216.73
7.2.290.0110.00516.74
7.2.250.0190.00015.06
7.2.240.0060.01116.20
7.2.230.0080.00516.18
7.2.220.0060.00616.25
7.2.210.0100.00416.03
7.2.200.0050.01116.07
7.2.190.0080.00816.19
7.2.180.0130.00515.99
7.2.170.0110.00616.16
7.2.160.0030.01417.15
7.2.150.0070.01017.15
7.2.140.0090.00617.15
7.2.130.0070.01117.15
7.2.120.0060.00817.15
7.2.110.0090.00617.15
7.2.100.0030.01317.15
7.2.90.0110.00717.15
7.2.80.0030.01517.15
7.2.70.0110.00717.20
7.2.60.0060.00717.01
7.2.50.0110.00717.15
7.2.40.0040.01117.15
7.2.30.0070.00717.15
7.2.20.0090.00617.15
7.2.10.0030.01017.15
7.2.00.0040.01217.15
7.1.330.0060.00616.48
7.1.320.0050.00716.50
7.1.310.0030.01116.55
7.1.300.0050.00916.37
7.1.290.0050.00816.47
7.1.280.0090.00816.42
7.1.270.0060.00916.40
7.1.260.0090.00416.51
7.1.250.0070.00717.15
7.1.200.0040.00815.84
7.1.100.0900.00916.34
7.1.70.0040.00417.37
7.1.60.0130.01319.32
7.1.50.0040.02116.96
7.1.00.0030.07722.44
7.0.200.0030.00716.88
7.0.140.0100.06722.10
7.0.60.0030.05720.05
7.0.50.0000.04317.96
7.0.40.0030.04319.96
7.0.30.0270.06020.26
7.0.20.0270.05320.33
7.0.10.0070.08720.16
7.0.00.0030.05020.19
5.6.280.0030.07321.04
5.6.210.0030.04320.77
5.6.200.0070.08018.22
5.6.190.0130.04020.33
5.6.180.0130.06020.63
5.6.170.0400.05020.47
5.6.160.0100.08320.44
5.6.150.0070.05018.14
5.6.140.0030.05318.18
5.6.130.0000.06318.27
5.6.120.0100.07721.14
5.6.110.0030.07720.91
5.6.100.0070.08721.01
5.6.90.0130.04720.98
5.6.80.0100.06720.55
5.5.350.1800.03720.39
5.5.340.0070.03317.99
5.5.330.0230.06720.39
5.5.320.0870.05020.31
5.5.310.0370.07020.34
5.5.300.0030.04717.98
5.5.290.0030.05317.95
5.5.280.0170.04020.75
5.5.270.0070.03720.82
5.5.260.0100.05320.81
5.5.250.0130.07720.71
5.5.240.0000.04020.05
5.4.450.0370.04019.47
5.4.440.0230.07719.64
5.4.430.0270.06719.43
5.4.420.0270.03719.38
5.4.410.0230.07719.39
5.4.400.0330.06319.00
5.4.390.0270.04719.20
5.4.380.0270.06019.24
5.4.370.0330.05319.21
5.4.360.0170.08018.98
5.4.350.0270.05319.24
5.4.340.0270.04718.95
5.4.320.0300.07019.31
5.4.310.0270.04019.20
5.4.300.0270.04719.16
5.4.290.0270.06719.14
5.4.280.0270.06319.16
5.4.270.0300.05319.16
5.4.260.0230.08019.19
5.4.250.0270.04319.23
5.4.240.0330.04019.25
5.4.230.0300.06319.02
5.4.220.0230.07018.94
5.4.210.0270.06319.05
5.4.200.0270.07318.95
5.4.190.0330.06019.13
5.4.180.0270.07319.30
5.4.170.0400.05719.20
5.4.160.0200.04318.80
5.4.150.0270.04019.28
5.4.140.0200.04316.57
5.4.130.0230.07016.38
5.4.120.0230.03716.34
5.4.110.0230.06316.41
5.4.100.0270.07316.25
5.4.90.0370.06016.33
5.4.80.0230.06716.46
5.4.70.0170.05016.49
5.4.60.0270.06716.18
5.4.50.0200.06016.38
5.4.40.0200.03716.53
5.4.30.0230.04016.52
5.4.20.0300.05016.23
5.4.10.0230.05716.35
5.4.00.0330.05715.95
5.3.290.0270.04014.77
5.3.280.0370.06014.67
5.3.270.0230.06714.54
5.3.260.0200.07714.78
5.3.250.0270.05314.55
5.3.240.0200.04014.64
5.3.230.0200.04014.52
5.3.220.0170.07714.67
5.3.210.0230.05314.50
5.3.200.0230.03314.71
5.3.190.0300.03714.67
5.3.180.0270.04014.67
5.3.170.0270.04014.60
5.3.160.0270.06714.73
5.3.150.0270.07014.49
5.3.140.0270.07014.57
5.3.130.0270.06314.58
5.3.120.0330.06314.48
5.3.110.0270.03314.80
5.3.100.0230.06014.05
5.3.90.0270.04314.12
5.3.80.0230.03314.12
5.3.70.0230.04714.16
5.3.60.0270.03014.04
5.3.50.0100.04714.10
5.3.40.0200.05314.20
5.3.30.0270.04013.84
5.3.20.0300.06313.72
5.3.10.0270.04013.70
5.3.00.0300.05013.89
5.2.170.0200.06013.30
5.2.160.0130.03313.30
5.2.150.0230.03313.30
5.2.140.0170.05713.30
5.2.130.0200.03313.30
5.2.120.0270.02713.30
5.2.110.0230.03313.30
5.2.100.0270.03013.30
5.2.90.0200.05713.30
5.2.80.0300.03013.30
5.2.70.0230.06013.30
5.2.60.0130.03713.30
5.2.50.0200.06313.30
5.2.40.0300.04713.30
5.2.30.0200.04013.30
5.2.20.0170.03313.30
5.2.10.0170.03713.30
5.2.00.0270.04713.30
5.1.60.0230.04313.30
5.1.50.0130.04713.30
5.1.40.0200.04013.30
5.1.30.0170.05313.30
5.1.20.0170.03013.30
5.1.10.0230.04713.30
5.1.00.0130.04013.30
5.0.50.0070.02313.30
5.0.40.0100.01713.30
5.0.30.0100.06013.30
5.0.20.0100.02013.30
5.0.10.0100.02013.30
5.0.00.0070.05313.30
4.4.90.0070.02313.30
4.4.80.0070.02713.30
4.4.70.0070.02313.30
4.4.60.0070.03713.30
4.4.50.0130.02013.30
4.4.40.0070.04713.30
4.4.30.0100.01313.30
4.4.20.0070.03013.30
4.4.10.0070.01713.30
4.4.00.0170.02713.30
4.3.110.0030.02013.30
4.3.100.0070.03313.30
4.3.90.0130.02013.30
4.3.80.0100.05313.30
4.3.70.0100.02313.30
4.3.60.0070.03713.30
4.3.50.0030.02013.30
4.3.40.0100.05013.30
4.3.30.0070.03313.30
4.3.20.0030.04013.30
4.3.10.0070.02013.30
4.3.00.0030.03313.30

preferences:
44.32 ms | 401 KiB | 5 Q