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]); key($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.0070.01118.49
8.3.50.0150.00722.00
8.3.40.0170.00718.84
8.3.30.0100.00319.21
8.3.20.0040.00420.33
8.3.10.0040.00420.71
8.3.00.0070.00419.79
8.2.180.0130.00316.63
8.2.170.0070.00722.96
8.2.160.0130.00320.10
8.2.150.0090.00024.18
8.2.140.0030.00524.66
8.2.130.0050.00526.16
8.2.120.0050.00322.06
8.2.110.0080.00422.25
8.2.100.0080.00617.56
8.2.90.0060.00317.75
8.2.80.0000.00917.97
8.2.70.0030.00618.04
8.2.60.0000.00818.05
8.2.50.0060.00419.78
8.2.40.0040.00420.61
8.2.30.0030.00619.14
8.2.20.0030.00717.75
8.2.10.0030.00518.01
8.2.00.0040.00417.82
8.1.280.0070.01425.92
8.1.270.0040.00423.91
8.1.260.0000.00826.35
8.1.250.0030.00628.09
8.1.240.0040.00422.64
8.1.230.0030.00919.02
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0060.00317.23
8.1.180.0040.00418.10
8.1.170.0040.00418.54
8.1.160.0050.00222.04
8.1.150.0040.00418.90
8.1.140.0000.00817.51
8.1.130.0030.00317.75
8.1.120.0000.00717.49
8.1.110.0020.00517.35
8.1.100.0000.00717.44
8.1.90.0000.00717.44
8.1.80.0040.00417.38
8.1.70.0050.00217.44
8.1.60.0030.00617.61
8.1.50.0080.00017.40
8.1.40.0050.00317.52
8.1.30.0040.00417.64
8.1.20.0000.00917.56
8.1.10.0060.00317.46
8.1.00.0070.00317.57
8.0.300.0070.00019.56
8.0.290.0040.00416.75
8.0.280.0030.00318.46
8.0.270.0050.00217.27
8.0.260.0040.00417.27
8.0.250.0030.00317.05
8.0.240.0030.00316.94
8.0.230.0040.00416.98
8.0.220.0000.00716.86
8.0.210.0070.00016.81
8.0.200.0000.00816.83
8.0.190.0080.00016.99
8.0.180.0050.00216.77
8.0.170.0060.00316.90
8.0.160.0000.00716.78
8.0.150.0000.00716.88
8.0.140.0000.00816.81
8.0.130.0000.00613.36
8.0.120.0080.00016.70
8.0.110.0040.00416.90
8.0.100.0050.00216.89
8.0.90.0040.00416.97
8.0.80.0070.01016.91
8.0.70.0000.00816.95
8.0.60.0040.00416.89
8.0.50.0030.00516.68
8.0.30.0110.01217.05
8.0.20.0090.01117.40
8.0.10.0000.00816.97
8.0.00.0090.01116.85
7.4.330.0020.00215.19
7.4.320.0070.00016.61
7.4.300.0000.00816.60
7.4.290.0020.00516.48
7.4.280.0040.00416.50
7.4.270.0040.00416.55
7.4.260.0040.00416.48
7.4.250.0030.00616.53
7.4.240.0020.00516.53
7.4.230.0030.00316.42
7.4.220.0060.01016.66
7.4.210.0100.01016.57
7.4.200.0000.00816.51
7.4.160.0100.00716.49
7.4.150.0100.01317.40
7.4.140.0150.00617.86
7.4.130.0090.00816.52
7.4.120.0090.00816.54
7.4.110.0040.01416.52
7.4.100.0100.01316.49
7.4.90.0070.01116.51
7.4.80.0070.01016.56
7.4.70.0100.01316.66
7.4.60.0080.00716.64
7.4.50.0080.00016.14
7.4.40.0100.00616.62
7.4.30.0130.01016.39
7.4.00.0060.01115.03
7.3.330.0050.00013.41
7.3.320.0000.00513.33
7.3.310.0030.00516.43
7.3.300.0030.00316.38
7.3.290.0070.00716.39
7.3.280.0080.00816.35
7.3.270.0110.00717.40
7.3.260.0030.01316.38
7.3.250.0160.00616.42
7.3.240.0040.01516.33
7.3.230.0070.01016.61
7.3.210.0130.00416.44
7.3.200.0060.01219.39
7.3.190.0090.00916.35
7.3.180.0080.00816.39
7.3.170.0070.01016.38
7.3.160.0030.01316.38
7.3.120.0100.01015.04
7.3.110.0100.00314.58
7.3.100.0100.00314.80
7.3.90.0060.00614.78
7.3.80.0030.00714.70
7.3.70.0000.01314.80
7.3.60.0040.01214.66
7.3.50.0090.00415.04
7.3.40.0070.00715.00
7.3.30.0050.00814.61
7.3.20.0030.00916.80
7.3.10.0030.01016.86
7.3.00.0090.00616.75
7.2.330.0100.00716.85
7.2.320.0160.00916.69
7.2.310.0030.01516.75
7.2.300.0070.01116.64
7.2.290.0130.00316.89
7.2.250.0110.00715.01
7.2.240.0040.01115.20
7.2.230.0100.00315.14
7.2.220.0000.01315.00
7.2.210.0090.00314.87
7.2.200.0100.00315.24
7.2.190.0080.00515.16
7.2.180.0070.00715.19
7.2.170.0060.01015.20
7.2.60.0070.01016.70
7.2.00.0070.00719.17
7.1.330.0040.01215.66
7.1.320.0030.00915.78
7.1.310.0030.01215.92
7.1.300.0060.00915.59
7.1.290.0000.01215.86
7.1.280.0040.01115.62
7.1.270.0060.00315.89
7.1.260.0100.00315.54
7.1.200.0060.00615.74
7.1.100.0880.00716.45
7.1.70.0070.00316.93
7.1.60.0100.01419.32
7.1.50.0140.01017.06
7.1.00.0100.06722.43
7.0.200.0040.00416.47
7.0.140.0070.07022.04
7.0.60.0070.08719.93
7.0.50.0030.04017.87
7.0.40.0100.05020.25
7.0.30.0270.07020.11
7.0.20.0330.07720.19
7.0.10.0100.08320.33
7.0.00.0200.07020.06
5.6.280.0000.07321.02
5.6.210.0070.07320.57
5.6.200.0130.07318.19
5.6.190.0230.04320.46
5.6.180.0370.04320.50
5.6.170.0430.07320.71
5.6.160.0070.04020.55
5.6.150.0070.05018.29
5.6.140.0070.07718.21
5.6.130.0070.04718.13
5.6.120.0200.06720.94
5.6.110.0200.06021.05
5.6.100.0030.04021.13
5.6.90.0100.08721.02
5.6.80.0100.07320.53
5.5.350.0130.06020.46
5.5.340.0000.04318.05
5.5.330.0130.06320.27
5.5.320.0330.08020.51
5.5.310.0270.07720.32
5.5.300.0030.07718.08
5.5.290.0100.08317.94
5.5.280.0130.08721.00
5.5.270.0100.08320.89
5.5.260.0100.06020.81
5.5.250.0070.04720.61
5.5.240.0270.06320.09
5.4.450.0330.05719.41
5.4.440.0500.06319.64
5.4.430.0370.06719.19
5.4.420.0370.05019.40
5.4.410.0330.03319.33
5.4.400.0330.05018.95
5.4.390.0470.03719.09
5.4.380.0500.05719.08
5.4.370.0330.04719.13
5.4.360.0400.06019.16
5.4.350.0470.06019.01
5.4.340.0430.06718.98
5.4.320.0430.06319.14
5.4.310.0330.04318.98
5.4.300.0430.06319.07
5.4.290.0470.06718.98
5.4.280.0470.06719.13
5.4.270.0470.06718.97
5.4.260.0370.04319.13
5.4.250.0470.06719.24
5.4.240.0400.05319.22
5.4.230.0400.04319.07
5.4.220.0400.07719.21
5.4.210.0370.04019.30
5.4.200.0330.04318.97
5.4.190.0430.06318.93
5.4.180.0470.04318.86
5.4.170.0270.05719.07
5.4.160.0300.03718.92
5.4.150.0230.04319.21
5.4.140.0330.03316.37
5.4.130.0270.03716.36
5.4.120.0270.03716.38
5.4.110.0270.04316.61
5.4.100.0330.03316.64
5.4.90.0300.04716.50
5.4.80.0330.03716.60
5.4.70.0370.04316.57
5.4.60.0270.03716.38
5.4.50.0270.03716.49
5.4.40.0300.03716.51
5.4.30.0300.03316.50
5.4.20.0300.03316.34
5.4.10.0370.04716.37
5.4.00.0270.03715.78
5.3.290.0370.04014.67
5.3.280.0430.05714.61
5.3.270.0330.03314.73
5.3.260.0300.03714.63
5.3.250.0300.03714.64
5.3.240.0270.04014.85
5.3.230.0370.03714.63
5.3.220.0570.02314.58
5.3.210.0430.04014.68
5.3.200.0370.04014.64
5.3.190.0430.06014.57
5.3.180.0370.03314.56
5.3.170.0270.04014.56
5.3.160.0370.03714.50
5.3.150.0330.04714.59
5.3.140.0330.03314.67
5.3.130.0300.03714.62
5.3.120.0330.03314.49
5.3.110.0500.03014.80
5.3.100.0600.04313.99
5.3.90.0300.04014.11
5.3.80.0270.03713.95
5.3.70.0300.03314.27
5.3.60.0330.03314.11
5.3.50.0270.03714.05
5.3.40.0370.04014.20
5.3.30.0370.04713.86
5.3.20.0370.04313.80
5.3.10.0430.03713.68
5.3.00.0270.03713.71
5.2.170.0270.02711.54
5.2.160.0270.02711.55
5.2.150.0200.03311.58
5.2.140.0300.02311.59
5.2.130.0270.02711.60
5.2.120.0270.02311.61
5.2.110.0270.02711.61
5.2.100.0270.02311.64
5.2.90.0230.03311.64
5.2.80.0270.05711.64
5.2.70.0300.05011.66
5.2.60.0330.04711.68
5.2.50.0270.05311.71
5.2.40.0230.03711.72
5.2.30.0330.03311.74
5.2.20.0300.03311.74
5.2.10.0370.04711.75
5.2.00.0370.04311.75
5.1.60.0230.03711.75
5.1.50.0270.02311.75
5.1.40.0470.01711.75
5.1.30.0300.05011.75
5.1.20.0370.04011.75
5.1.10.0400.04311.75
5.1.00.0300.05311.75
5.0.50.0200.04011.75
5.0.40.0170.02711.75
5.0.30.0200.06011.75
5.0.20.0200.03011.75
5.0.10.0130.03311.75
5.0.00.0130.06011.75
4.4.90.0130.03311.68
4.4.80.0070.02011.70
4.4.70.0230.02311.75
4.4.60.0170.03011.75
4.4.50.0130.03011.75
4.4.40.0100.03311.75
4.4.30.0130.02011.75
4.4.20.0200.03011.75
4.4.10.0170.03011.75
4.4.00.0170.04711.75
4.3.110.0200.03011.75
4.3.100.0170.02011.75
4.3.90.0170.03011.75
4.3.80.0230.03711.75
4.3.70.0130.03311.75
4.3.60.0130.03011.75
4.3.50.0130.02311.75
4.3.40.0170.03311.75
4.3.30.0030.02011.75
4.3.20.0100.03711.75
4.3.10.0070.04011.75
4.3.00.0030.02311.75

preferences:
41.94 ms | 401 KiB | 5 Q