3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $val; public function __construct($val) { $this->val = $val; } } $storage = new SplObjectStorage; $storage->attach(new A(1)); $storage->attach(new A(2)); $storage->attach(new A(3)); $storage->attach(new A(4)); $storage->attach(new A(5)); $storage->attach(new A(6)); $storage->attach(new A(7)); $storage->attach(new A(8)); $storage->attach(new A(9)); $storage->attach(new A(10)); $iterations = 0; $expected = 10; // 10 iterations is expected, as storage has 10 objects attached $storage->rewind(); while ($storage->valid()) { $iterations++; $object = $storage->current(); echo 'Iteration #' . $iterations . ' with object A(' . $object->val . ')'; $storage->next(); if($iterations === 2 || $iterations === 8) { echo ' - deleted Object A(' . $object->val . ') ' . PHP_EOL; $storage->detach($object); continue; } echo PHP_EOL; } if(count($storage) != $iterations) { echo 'Error! - too much iterations!' . PHP_EOL; } else { echo 'Success - there was 10 iterations as expected.' . PHP_EOL; }

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.01116.50
8.3.50.0140.00221.89
8.3.40.0100.00718.84
8.3.30.0110.00319.05
8.3.20.0070.00720.17
8.3.10.0040.00423.48
8.3.00.0070.00319.20
8.2.180.0090.00618.54
8.2.170.0110.00422.96
8.2.160.0070.00720.38
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0000.00822.00
8.2.110.0090.00022.14
8.2.100.0070.00417.91
8.2.90.0000.00819.17
8.2.80.0000.00817.97
8.2.70.0000.00817.50
8.2.60.0000.00817.80
8.2.50.0030.00618.07
8.2.40.0050.00218.16
8.2.30.0040.00418.09
8.2.20.0000.00717.64
8.2.10.0050.00318.21
8.2.00.0030.00717.82
8.1.280.0130.00325.92
8.1.270.0050.00322.11
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0040.00423.91
8.1.230.0060.00618.96
8.1.220.0060.00317.74
8.1.210.0050.00318.77
8.1.200.0060.00317.36
8.1.190.0000.00817.40
8.1.180.0040.00418.10
8.1.170.0060.00318.64
8.1.160.0070.00021.90
8.1.150.0000.00718.64
8.1.140.0040.00417.59
8.1.130.0000.00717.73
8.1.120.0040.00417.54
8.1.110.0000.00717.46
8.1.100.0000.00817.52
8.1.90.0040.00417.52
8.1.80.0000.00717.56
8.1.70.0000.00717.39
8.1.60.0030.00717.61
8.1.50.0000.00817.61
8.1.40.0070.00017.45
8.1.30.0030.00517.55
8.1.20.0040.00417.69
8.1.10.0030.00517.49
8.1.00.0080.00017.55
8.0.300.0000.00718.77
8.0.290.0080.00017.30
8.0.280.0030.00318.48
8.0.270.0040.00417.25
8.0.260.0000.00617.20
8.0.250.0000.00716.83
8.0.240.0050.00516.88
8.0.230.0000.00816.88
8.0.220.0030.00316.98
8.0.210.0030.00316.84
8.0.200.0030.00316.85
8.0.190.0100.00016.97
8.0.180.0040.00416.82
8.0.170.0080.00016.93
8.0.160.0070.00016.99
8.0.150.0040.00416.83
8.0.140.0020.00516.94
8.0.130.0070.00013.39
8.0.120.0070.00016.82
8.0.110.0040.00416.91
8.0.100.0040.00416.80
8.0.90.0000.00716.71
8.0.80.0060.01516.93
8.0.70.0040.00416.80
8.0.60.0050.00316.93
8.0.50.0070.00016.91
8.0.30.0080.01017.21
8.0.20.0090.00917.40
8.0.10.0000.00716.90
8.0.00.0130.00816.68
7.4.330.0050.00015.00
7.4.320.0030.00616.54
7.4.300.0000.00716.68
7.4.290.0040.00416.64
7.4.280.0070.00016.67
7.4.270.0000.00716.54
7.4.260.0030.00716.45
7.4.250.0030.00316.63
7.4.240.0050.00216.57
7.4.230.0070.00016.74
7.4.220.0030.01516.68
7.4.210.0060.01216.66
7.4.200.0070.00016.59
7.4.190.0000.00716.79
7.4.160.0130.01016.45
7.4.150.0150.00317.40
7.4.140.0120.00717.86
7.4.130.0080.01116.52
7.4.120.0090.00916.69
7.4.110.0090.00916.52
7.4.100.0130.00616.36
7.4.90.0100.00716.46
7.4.80.0080.01119.39
7.4.70.0110.00516.39
7.4.60.0100.00616.57
7.4.50.0030.00616.38
7.4.40.0070.00722.77
7.4.30.0120.00916.71
7.4.10.0060.01314.93
7.4.00.0100.00514.93
7.3.330.0050.00013.26
7.3.320.0050.00013.38
7.3.310.0040.00416.21
7.3.300.0070.00016.27
7.3.290.0070.00716.36
7.3.280.0060.01216.44
7.3.270.0080.00817.40
7.3.260.0090.00916.50
7.3.250.0090.00916.49
7.3.240.0090.00916.53
7.3.230.0140.00416.39
7.3.210.0030.01516.67
7.3.200.0070.01719.39
7.3.190.0070.01016.37
7.3.180.0060.00916.68
7.3.170.0030.01316.55
7.3.160.0070.01116.35
7.3.130.0060.00914.82
7.3.120.0050.01114.98
7.3.110.0060.00914.90
7.3.100.0060.01015.20
7.3.90.0030.01314.84
7.3.80.0070.01014.85
7.3.70.0060.00614.98
7.3.60.0070.00714.84
7.3.50.0090.00614.67
7.3.40.0030.01014.95
7.3.30.0070.01115.06
7.3.20.0070.01016.74
7.3.10.0070.00716.77
7.3.00.0030.01016.66
7.2.330.0140.00416.71
7.2.320.0140.00316.84
7.2.310.0060.01116.82
7.2.300.0110.01116.71
7.2.290.0090.00916.50
7.2.260.0040.01114.96
7.2.250.0060.01215.32
7.2.240.0070.00615.03
7.2.230.0000.01414.95
7.2.220.0090.00615.25
7.2.210.0030.00915.15
7.2.200.0060.00615.12
7.2.190.0040.01514.93
7.2.180.0100.00315.05
7.2.170.0040.01115.23
7.2.160.0070.01015.25
7.2.150.0060.01016.95
7.2.140.0040.00716.90
7.2.130.0030.01516.96
7.2.120.0090.00616.91
7.2.110.0030.01416.75
7.2.100.0030.01016.67
7.2.90.0110.00416.95
7.2.80.0030.01017.09
7.2.70.0030.00617.10
7.2.60.0080.00916.92
7.2.50.0060.00917.09
7.2.40.0120.00317.06
7.2.30.0090.00917.06
7.2.20.0040.01117.04
7.2.10.0060.01217.17
7.2.00.0020.00918.30
7.1.330.0030.01316.12
7.1.320.0060.01016.01
7.1.310.0000.01015.75
7.1.300.0080.00815.68
7.1.290.0080.00815.92
7.1.280.0090.00015.96
7.1.270.0090.00615.86
7.1.260.0000.01115.73
7.1.250.0060.00615.88
7.1.240.0030.01015.67
7.1.230.0030.00915.99
7.1.220.0080.00415.94
7.1.210.0070.00715.89
7.1.200.0050.00715.78
7.1.190.0100.00315.95
7.1.180.0060.00615.91
7.1.170.0100.00715.68
7.1.160.0040.00715.84
7.1.150.0030.01415.58
7.1.140.0030.00615.83
7.1.130.0030.01015.76
7.1.120.0080.00415.86
7.1.110.0070.00715.96
7.1.100.0070.00617.10
7.1.90.0000.00915.69
7.1.80.0100.00315.88
7.1.70.0060.00316.40
7.1.60.0090.00917.56
7.1.50.0080.01016.31
7.1.40.0070.00715.90
7.1.30.0030.00615.62
7.1.20.0000.01215.95
7.1.10.0070.01115.78
7.1.00.0040.03818.99
7.0.330.0070.00715.20
7.0.320.0070.00415.44
7.0.310.0050.00815.27
7.0.300.0070.01015.46
7.0.290.0070.01015.17
7.0.280.0100.00715.12
7.0.270.0100.00015.35
7.0.260.0050.00315.47
7.0.250.0040.00715.64
7.0.240.0100.00315.36
7.0.230.0060.00615.58
7.0.220.0070.00715.59
7.0.210.0030.00615.42
7.0.200.0130.00815.22
7.0.190.0040.00715.42
7.0.180.0100.00315.49
7.0.170.0040.00415.58
7.0.160.0040.01115.34
7.0.150.0040.00715.43
7.0.140.0090.03618.82
7.0.130.0090.00315.50
7.0.120.0060.00315.48
7.0.110.0130.00315.52
7.0.100.0060.04117.81
7.0.90.0150.03517.76
7.0.80.0120.04217.61
7.0.70.0020.03117.59
7.0.60.0020.04817.60
7.0.50.0130.04417.80
7.0.40.0080.04116.87
7.0.30.0020.04616.87
7.0.20.0050.04416.70
7.0.10.0050.02716.77
7.0.00.0080.02616.70
5.6.400.0050.00514.32
5.6.390.0070.01014.17
5.6.380.0000.01514.66
5.6.370.0110.00714.45
5.6.360.0100.00714.42
5.6.350.0120.00414.76
5.6.340.0070.01014.74
5.6.330.0070.00714.56
5.6.320.0070.00414.53
5.6.310.0060.01014.51
5.6.300.0080.00614.25
5.6.290.0040.00414.62
5.6.280.0070.03917.67
5.6.270.0030.01014.03
5.6.260.0090.00614.21
5.6.250.0080.03017.58
5.6.240.0060.03917.49
5.6.230.0020.03117.66
5.6.220.0050.04917.50
5.6.210.0050.04417.49
5.6.200.0020.04517.78
5.6.190.0080.02517.69
5.6.180.0030.04517.81
5.6.170.0030.04517.81
5.6.160.0070.03317.80
5.6.150.0050.04417.71
5.6.140.0070.02717.87
5.6.130.0080.04017.77
5.6.120.0080.04217.78
5.6.110.0130.04017.62
5.6.100.0050.02317.57
5.6.90.0090.04417.63
5.6.80.0070.02317.42
5.6.70.0050.04417.32
5.6.60.0070.03917.38
5.6.50.0000.02617.44
5.6.40.0060.02517.50
5.6.30.0050.02217.34
5.6.20.0050.02317.42
5.6.10.0050.02317.28
5.6.00.0040.02217.32
5.5.380.0070.03817.46
5.5.370.0080.02717.44
5.5.360.0060.02317.36
5.5.350.0030.03717.31
5.5.340.0090.03217.54
5.5.330.0090.04117.46
5.5.320.0070.04217.48
5.5.310.0000.04917.52
5.5.300.0070.04717.59
5.5.290.0080.02717.40
5.5.280.0080.04817.52
5.5.270.0080.02817.58
5.5.260.0050.02517.68
5.5.250.0030.03317.53
5.5.240.0060.02817.27
5.5.230.0050.04017.27
5.5.220.0030.04017.16
5.5.210.0040.02617.28
5.5.200.0000.02917.15
5.5.190.0020.02717.27
5.5.180.0020.02717.29
5.5.170.0080.00814.19
5.5.160.0050.02017.28
5.5.150.0070.01717.19
5.5.140.0060.01817.24
5.5.130.0010.02117.15
5.5.120.0100.01517.15
5.5.110.0080.02517.27
5.5.100.0050.01917.01
5.5.90.0030.01917.16
5.5.80.0030.02217.09
5.5.70.0050.02516.99
5.5.60.0020.02217.12
5.5.50.0000.02517.11
5.5.40.0080.01617.04
5.5.30.0050.02217.15
5.5.20.0070.02017.30
5.5.10.0080.01817.23
5.5.00.0030.02317.13
5.4.450.0050.04715.29
5.4.440.0030.02814.98
5.4.430.0050.04215.25
5.4.420.0040.02215.24
5.4.410.0050.03515.01
5.4.400.0070.03015.00
5.4.390.0030.03115.23
5.4.380.0000.04515.00
5.4.370.0080.02014.95
5.4.360.0050.02115.13
5.4.350.0050.02014.94
5.4.340.0020.02214.89
5.4.330.0040.00410.88
5.4.320.0060.01515.02
5.4.310.0000.02414.97
5.4.300.0060.01815.13
5.4.290.0000.02214.97
5.4.280.0020.02414.98
5.4.270.0030.02015.03
5.4.260.0030.01815.07
5.4.250.0050.01814.88
5.4.240.0030.01814.93
5.4.230.0030.02415.01
5.4.220.0000.03114.93
5.4.210.0000.02014.96
5.4.200.0020.02214.75
5.4.190.0050.01515.14
5.4.180.0040.02215.02
5.4.170.0020.02414.91
5.4.160.0020.01915.10
5.4.150.0040.02415.15
5.4.140.0030.02013.62
5.4.130.0040.02013.66
5.4.120.0060.01513.74
5.4.110.0060.01613.77
5.4.100.0030.02313.83
5.4.90.0020.02313.70
5.4.80.0080.01613.69
5.4.70.0040.02013.69
5.4.60.0020.02113.61
5.4.50.0060.02013.75
5.4.40.0020.02313.68
5.4.30.0020.02513.72
5.4.20.0070.01713.74
5.4.10.0000.02413.79
5.4.00.0030.02013.46
5.3.290.0080.01312.63
5.3.280.0030.02012.59
5.3.270.0050.02212.61
5.3.260.0030.02112.73
5.3.250.0020.02612.51
5.3.240.0020.02312.46
5.3.230.0000.02512.53
5.3.220.0050.02012.60
5.3.210.0050.01812.52
5.3.200.0030.02212.36
5.3.190.0010.02212.51
5.3.180.0030.02112.54
5.3.170.0030.02812.60
5.3.160.0020.02212.53
5.3.150.0030.02212.56
5.3.140.0030.02312.58
5.3.130.0030.02212.61
5.3.120.0050.01912.59
5.3.110.0050.03812.66
5.3.100.0030.04012.34
5.3.90.0030.03312.40
5.3.80.0030.03712.25
5.3.70.0050.03312.22
5.3.60.0110.03312.35
5.3.50.0050.02812.18
5.3.40.0050.04012.25
5.3.30.0060.03812.32
5.3.20.0020.02012.20
5.3.10.0040.02312.07
5.3.00.0000.02211.88
5.2.170.0070.06312.61
5.2.160.0070.06312.61
5.2.150.0070.04712.61
5.2.140.0000.03712.61
5.2.130.0100.05712.61
5.2.120.0030.06012.61
5.2.110.0000.06012.61
5.2.100.0070.05312.61
5.2.90.0030.05712.61
5.2.80.0030.05312.61
5.2.70.0000.06012.61
5.2.60.0070.06312.61
5.2.50.0000.03012.61
5.2.40.0000.05012.61
5.2.30.0030.02712.61
5.2.20.0030.06312.61
5.2.10.0070.05012.61
5.2.00.0000.05712.61
5.1.60.0030.05012.61
5.1.50.0000.03312.61
5.1.40.0000.04312.61
5.1.30.0030.02712.61
5.1.20.0000.04012.61
5.1.10.0030.05312.61
5.1.00.0070.02312.61
5.0.50.0000.02012.61
5.0.40.0030.03312.61
5.0.30.0000.07012.61
5.0.20.0070.02712.61
5.0.10.0000.03712.61
5.0.00.0100.05312.61
4.4.90.0000.03012.61
4.4.80.0030.03312.61
4.4.70.0000.01712.61
4.4.60.0000.01712.61
4.4.50.0070.02012.61
4.4.40.0000.02312.61
4.4.30.0000.01312.61
4.4.20.0030.01312.61
4.4.10.0000.01712.61
4.4.00.0000.05712.61
4.3.110.0000.04012.61
4.3.100.0070.03012.61
4.3.90.0000.04012.61
4.3.80.0000.02312.61
4.3.70.0030.03012.61
4.3.60.0000.03312.61
4.3.50.0000.03712.61
4.3.40.0000.02312.61
4.3.30.0000.03012.61
4.3.20.0030.03312.61
4.3.10.0000.02312.61
4.3.00.0000.03312.61

preferences:
44.15 ms | 401 KiB | 5 Q