3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $val; public function __construct($val) { $this->val = $val; } public function rewind() { echo __METHOD__; parent::rewind(); } } $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.0040.01118.43
8.3.50.0110.00622.11
8.3.40.0190.00318.72
8.3.30.0110.00318.54
8.3.20.0080.00018.65
8.3.10.0050.00319.10
8.3.00.0050.00223.46
8.2.180.0070.01116.47
8.2.170.0030.01322.96
8.2.160.0070.01020.34
8.2.150.0130.00724.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00319.36
8.2.110.0090.00022.13
8.2.100.0080.00417.72
8.2.90.0030.00519.09
8.2.80.0050.00317.97
8.2.70.0000.00817.38
8.2.60.0040.00917.68
8.2.50.0030.00618.10
8.2.40.0030.00620.42
8.2.30.0060.00319.77
8.2.20.0070.00017.44
8.2.10.0040.00417.47
8.2.00.0000.00717.54
8.1.280.0040.01125.92
8.1.270.0070.00023.99
8.1.260.0160.00326.35
8.1.250.0080.00028.09
8.1.240.0040.00819.25
8.1.230.0100.00017.42
8.1.220.0060.00317.74
8.1.210.0040.00418.77
8.1.200.0030.00617.22
8.1.190.0000.00917.10
8.1.180.0030.00618.10
8.1.170.0030.00518.53
8.1.160.0000.00818.68
8.1.150.0040.00418.43
8.1.140.0000.00717.26
8.1.130.0000.00817.80
8.1.120.0030.00317.36
8.1.110.0040.00417.36
8.1.100.0000.00717.30
8.1.90.0040.00317.29
8.1.80.0000.00717.32
8.1.70.0020.00517.20
8.1.60.0000.00817.34
8.1.50.0000.00817.30
8.1.40.0050.00217.27
8.1.30.0000.00717.58
8.1.20.0030.00617.55
8.1.10.0000.00717.31
8.1.00.0060.00317.34
8.0.300.0040.00418.77
8.0.290.0070.00016.63
8.0.280.0000.00718.38
8.0.270.0070.00017.13
8.0.260.0030.00316.75
8.0.250.0000.00716.90
8.0.240.0080.00016.91
8.0.230.0040.00416.82
8.0.220.0000.00716.86
8.0.210.0050.00316.87
8.0.200.0000.00716.94
8.0.190.0040.00416.75
8.0.180.0040.00416.84
8.0.170.0000.00816.87
8.0.160.0000.00816.79
8.0.150.0080.00016.82
8.0.140.0000.00716.80
8.0.130.0060.00013.23
8.0.120.0030.00516.71
8.0.110.0080.00016.78
8.0.100.0050.00316.75
8.0.90.0050.00316.77
8.0.80.0060.00916.78
8.0.70.0040.00416.72
8.0.60.0000.00816.84
8.0.50.0030.00316.81
8.0.30.0090.01116.88
8.0.20.0090.00917.40
8.0.10.0040.00416.84
8.0.00.0110.01016.70
7.4.330.0000.00614.89
7.4.320.0000.00716.54
7.4.300.0030.00316.55
7.4.290.0000.00716.59
7.4.280.0030.00516.64
7.4.270.0000.00716.40
7.4.260.0030.00313.35
7.4.250.0000.00816.57
7.4.240.0080.00016.68
7.4.230.0070.00016.71
7.4.220.0060.00916.59
7.4.210.0060.00916.53
7.4.200.0000.00716.75
7.4.190.0000.00716.73
7.4.160.0170.00016.57
7.4.150.0040.01417.40
7.4.140.0090.00817.86
7.4.130.0130.00816.61
7.4.120.0110.00616.58
7.4.110.0110.00716.70
7.4.100.0060.01216.63
7.4.90.0120.00616.45
7.4.80.0090.01819.37
7.4.70.0110.00616.71
7.4.60.0100.00716.58
7.4.50.0030.00616.56
7.4.40.0100.00322.27
7.4.30.0100.00716.50
7.4.00.0100.00614.89
7.3.330.0030.00313.26
7.3.320.0000.00613.42
7.3.310.0030.00316.25
7.3.300.0000.00716.44
7.3.290.0070.00716.36
7.3.280.0110.00616.42
7.3.270.0000.01817.40
7.3.260.0130.00518.24
7.3.250.0100.00916.60
7.3.240.0140.00716.65
7.3.230.0140.00316.75
7.3.210.0030.01416.63
7.3.200.0100.01019.39
7.3.190.0070.01616.68
7.3.180.0110.00816.26
7.3.170.0150.00816.38
7.3.160.0040.01216.55
7.3.120.0070.00714.64
7.2.330.0070.01016.82
7.2.320.0090.00916.90
7.2.310.0030.01516.68
7.2.300.0130.00316.77
7.2.290.0060.01316.73
7.2.00.0030.01219.46
7.1.100.0000.01618.06
7.1.70.0030.00517.21
7.1.60.0030.02019.40
7.1.50.0070.01417.00
7.1.00.0070.04322.57
7.0.200.0040.00416.85
7.0.140.0030.07322.15
7.0.60.0100.07719.81
7.0.50.0100.08317.88
7.0.40.0170.07317.75
7.0.30.0030.06017.73
7.0.20.0100.07717.84
7.0.10.0130.06017.83
7.0.00.0130.08017.81
5.6.280.0030.07321.00
5.6.210.0070.08020.77
5.6.200.0170.07018.20
5.6.190.0070.08318.18
5.6.180.0100.07718.15
5.6.170.0000.09018.17
5.6.160.0100.06718.18
5.6.150.0070.05718.15
5.6.140.0170.07018.19
5.6.130.0130.08018.28
5.6.120.0170.04718.21
5.6.110.0070.08018.14
5.6.100.0100.07318.28
5.6.90.0130.07718.25
5.6.80.0130.05317.56
5.6.70.0170.03317.56
5.6.60.0000.06717.53
5.6.50.0070.07717.66
5.6.40.0030.06717.52
5.6.30.0100.06717.53
5.6.20.0030.08317.53
5.6.10.0130.07317.59
5.6.00.0130.07317.56
5.5.350.0200.08320.45
5.5.340.0100.07717.98
5.5.330.0170.07018.09
5.5.320.0070.06717.99
5.5.310.0070.05317.96
5.5.300.0070.08017.95
5.5.290.0130.07718.04
5.5.280.0100.08017.96
5.5.270.0070.07717.96
5.5.260.0100.07718.06
5.5.250.0100.07317.79
5.5.240.0070.07717.46
5.5.230.0100.06717.35
5.5.220.0030.08017.36
5.5.210.0200.06317.35
5.5.200.0070.07717.32
5.5.190.0170.07017.30
5.5.180.0170.06017.34
5.5.160.0070.08017.34
5.5.150.0070.07717.39
5.5.140.0030.06017.34
5.5.130.0170.07017.32
5.5.120.0070.05017.41
5.5.110.0070.05717.32
5.5.100.0100.08017.20
5.5.90.0030.05317.23
5.5.80.0070.08017.23
5.5.70.0070.03717.29
5.5.60.0070.06317.20
5.5.50.0000.04317.20
5.5.40.0070.05317.29
5.5.30.0170.07017.21
5.5.20.0030.07717.20
5.5.10.0100.05717.22
5.5.00.0000.04717.25
5.4.450.0030.06719.39
5.4.440.0000.09019.36
5.4.430.0130.06719.35
5.4.420.0030.07719.37
5.4.410.0030.04319.33
5.4.400.0070.07319.02
5.4.390.0130.04719.03
5.4.380.0170.06719.16
5.4.370.0200.06718.89
5.4.360.0070.07319.27
5.4.350.0030.07719.27
5.4.340.0100.07019.10
5.4.320.0130.07319.10
5.4.310.0070.07719.07
5.4.300.0100.04319.03
5.4.290.0030.07019.03
5.4.280.0170.06019.03
5.4.270.0170.07019.01
5.4.260.0100.07718.95
5.4.250.0100.07319.02
5.4.240.0070.08019.11
5.4.230.0030.05719.04
5.4.220.0070.07719.12
5.4.210.0130.07319.09
5.4.200.0030.03719.01
5.4.190.0070.07319.04
5.4.180.0200.06719.26
5.4.170.0070.04319.04
5.4.160.0130.06719.15
5.4.150.0170.07019.02
5.4.140.0070.07316.58
5.4.130.0030.05716.41
5.4.120.0070.06016.42
5.4.110.0030.05316.39
5.4.100.0070.07316.38
5.4.90.0070.06316.31
5.4.80.0130.07016.37
5.4.70.0130.07016.59
5.4.60.0030.07016.56
5.4.50.0070.03716.32
5.4.40.0000.07716.45
5.4.30.0100.07016.36
5.4.20.0030.08016.40
5.4.10.0030.06716.37
5.4.00.0070.05715.84
5.3.290.0070.07714.69
5.3.280.0000.06314.61
5.3.270.0100.07314.62
5.3.260.0000.07014.65
5.3.250.0100.05714.68
5.3.240.0070.07714.47
5.3.230.0030.05014.58
5.3.220.0100.06714.63
5.3.210.0070.07714.55
5.3.200.0070.07314.61
5.3.190.0100.07314.58
5.3.180.0170.06014.61
5.3.170.0030.06314.59
5.3.160.0100.07014.43
5.3.150.0100.05014.68
5.3.140.0130.06714.52
5.3.130.0070.07714.57
5.3.120.0130.04014.61
5.3.110.0070.07714.57
5.3.100.0000.08014.15
5.3.90.0170.06714.13
5.3.80.0100.04314.04
5.3.70.0000.05714.07
5.3.60.0100.07014.01
5.3.50.0030.08014.02
5.3.40.0200.05314.02
5.3.30.0030.08013.94
5.3.20.0070.07713.75
5.3.10.0100.05713.55
5.3.00.0100.07013.86
5.2.170.0030.05011.06
5.2.160.0070.06011.17
5.2.150.0030.06311.06
5.2.140.0100.04311.05
5.2.130.0070.04711.18
5.2.120.0130.05010.97
5.2.110.0100.04311.16
5.2.100.0030.05711.18
5.2.90.0100.05311.02
5.2.80.0000.05711.32
5.2.70.0000.06011.21
5.2.60.0130.05311.12
5.2.50.0030.06711.00
5.2.40.0030.05711.09
5.2.30.0070.05710.98
5.2.20.0030.06711.03
5.2.10.0000.06710.98
5.2.00.0100.06010.64
5.1.60.0070.0279.98
5.1.50.0030.0539.99
5.1.40.0030.05710.07
5.1.30.0070.06010.32
5.1.20.0100.05010.59
5.1.10.0030.06010.16
5.1.00.0030.03710.13
5.0.50.0000.0408.56
5.0.40.0000.0408.64
5.0.30.0030.0438.28
5.0.20.0000.0478.22
5.0.10.0030.0438.20
5.0.00.0030.0538.15
4.4.90.0070.0307.68
4.4.80.0030.0307.68
4.4.70.0030.0307.68
4.4.60.0000.0377.68
4.4.50.0070.0277.68
4.4.40.0030.0307.68
4.4.30.0000.0277.68
4.4.20.0000.0307.68
4.4.10.0030.0337.68
4.4.00.0000.0477.68
4.3.110.0030.0237.68
4.3.100.0000.0337.68
4.3.90.0030.0337.68
4.3.80.0000.0437.68
4.3.70.0070.0207.68
4.3.60.0000.0237.68
4.3.50.0030.0377.68
4.3.40.0000.0537.68
4.3.30.0000.0237.68
4.3.20.0070.0337.68
4.3.10.0000.0377.68
4.3.00.0030.0377.68

preferences:
42.72 ms | 401 KiB | 5 Q