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.0120.00316.50
8.3.50.0110.00818.46
8.3.40.0130.00318.82
8.3.30.0120.00318.79
8.3.20.0000.00818.78
8.3.10.0030.00620.48
8.3.00.0030.00619.38
8.2.180.0040.01116.75
8.2.170.0150.00422.96
8.2.160.0170.00718.83
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0090.00026.16
8.2.120.0040.00818.64
8.2.110.0100.00720.52
8.2.100.0030.00717.72
8.2.90.0000.00919.17
8.2.80.0000.00719.16
8.2.70.0060.00317.63
8.2.60.0040.00417.93
8.2.50.0050.00319.23
8.2.40.0000.00818.22
8.2.30.0060.00318.02
8.2.20.0040.00417.62
8.2.10.0040.00417.91
8.2.00.0040.00417.79
8.1.280.0110.01125.92
8.1.270.0000.00823.99
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0080.00323.83
8.1.230.0090.00320.92
8.1.220.0000.00918.77
8.1.210.0060.00319.10
8.1.200.0040.00417.23
8.1.190.0040.00417.54
8.1.180.0000.00818.10
8.1.170.0000.00818.84
8.1.160.0000.00718.91
8.1.150.0040.00418.64
8.1.140.0040.00417.51
8.1.130.0000.00717.89
8.1.120.0000.00717.47
8.1.110.0050.00317.47
8.1.100.0000.00717.50
8.1.90.0080.00017.46
8.1.80.0030.00317.34
8.1.70.0060.00317.51
8.1.60.0000.00717.49
8.1.50.0030.00517.47
8.1.40.0050.00217.54
8.1.30.0040.00417.63
8.1.20.0050.00317.66
8.1.10.0000.00817.51
8.1.00.0080.00017.58
8.0.300.0040.00420.04
8.0.290.0000.00716.63
8.0.280.0000.00718.48
8.0.270.0070.00017.33
8.0.260.0030.00316.90
8.0.250.0050.00217.01
8.0.240.0000.00816.90
8.0.230.0040.00417.00
8.0.220.0040.00416.77
8.0.210.0000.00716.77
8.0.200.0060.00016.86
8.0.190.0040.00416.95
8.0.180.0070.00016.98
8.0.170.0040.00416.90
8.0.160.0000.00716.99
8.0.150.0040.00416.91
8.0.140.0000.00816.83
8.0.130.0000.00613.31
8.0.120.0040.00416.72
8.0.110.0000.00716.99
8.0.100.0000.00716.88
8.0.90.0070.00016.92
8.0.80.0100.00716.96
8.0.70.0080.00017.01
8.0.60.0050.00316.79
8.0.50.0000.00717.04
8.0.30.0090.01217.11
8.0.20.0090.00917.00
8.0.10.0000.00817.02
8.0.00.0090.01116.89
7.4.330.0000.00513.04
7.4.320.0000.00716.54
7.4.300.0000.00716.66
7.4.290.0000.00716.52
7.4.280.0030.00616.54
7.4.270.0000.00716.55
7.4.260.0000.00713.33
7.4.250.0000.00816.66
7.4.240.0000.00716.46
7.4.230.0070.00016.34
7.4.220.0070.01016.50
7.4.210.0030.01416.71
7.4.200.0000.00716.61
7.4.190.0000.00716.59
7.4.160.0100.00616.63
7.4.150.0070.01116.49
7.4.140.0170.00716.45
7.4.130.0100.01316.36
7.4.120.0130.00316.50
7.4.110.0100.00716.58
7.4.100.0090.01116.54
7.4.90.0150.00916.60
7.4.80.0030.01619.39
7.4.70.0060.01116.55
7.4.60.0130.00316.48
7.4.50.0030.00616.66
7.4.40.0040.01216.53
7.4.30.0080.00816.72
7.4.00.0070.01115.09
7.3.330.0000.00613.47
7.3.320.0050.00013.36
7.3.310.0000.00716.29
7.3.300.0000.00816.41
7.3.290.0070.00916.40
7.3.280.0080.00916.34
7.3.270.0190.00016.43
7.3.260.0170.00316.47
7.3.250.0100.01216.62
7.3.240.0100.01316.39
7.3.230.0090.01516.33
7.3.210.0070.01016.54
7.3.200.0130.00316.41
7.3.190.0100.00716.45
7.3.180.0030.01216.33
7.3.170.0180.00416.66
7.3.160.0090.01316.58
7.3.120.0120.00315.05
7.3.10.0120.00916.36
7.3.00.0130.00816.58
7.2.330.0170.01016.88
7.2.320.0120.00616.77
7.2.310.0190.00616.48
7.2.300.0160.00916.74
7.2.290.0080.00816.84
7.2.130.0070.01016.80
7.2.120.0170.00816.72
7.2.110.0150.00316.57
7.2.100.0090.00916.47
7.2.90.0120.00616.76
7.2.80.0100.00416.48
7.2.70.0110.00816.63
7.2.60.0170.00416.39
7.2.50.0120.00616.38
7.2.40.0170.00316.65
7.2.30.0120.00616.57
7.2.20.0170.00516.84
7.2.10.0090.00916.44
7.2.00.0030.01318.07
7.1.250.0130.01015.32
7.1.200.0040.00716.00
7.1.100.0040.00718.22
7.1.70.0040.01117.05
7.1.60.0140.01119.30
7.1.50.0140.01117.07
7.1.00.0000.06722.45
7.0.200.0290.00314.79
7.0.140.0070.07322.05
7.0.120.0070.06021.96
7.0.110.0300.04019.92
7.0.100.0470.08020.13
7.0.90.0500.06720.09
7.0.80.0370.06319.96
7.0.70.0430.07720.06
7.0.60.0400.04720.13
7.0.50.0470.06319.95
7.0.40.0070.07719.75
7.0.30.0100.05319.79
7.0.20.0100.08319.78
7.0.10.0030.08319.77
7.0.00.0100.03019.77
5.6.280.0070.07321.04
5.6.260.0070.04020.70
5.6.250.0000.04320.68
5.6.240.0170.07020.88
5.6.230.0070.07720.70
5.6.220.0100.06320.67
5.6.210.0030.08020.57
5.6.200.0070.04020.66
5.6.190.0030.03720.67
5.6.180.0000.04320.68
5.6.170.0070.07720.70
5.6.160.0070.09320.57
5.6.150.0030.05720.64
5.6.140.0070.05720.48
5.6.130.0100.07320.48
5.6.120.0070.07320.59
5.6.110.0100.07020.56
5.6.100.0170.05320.71
5.6.90.0100.07320.61
5.6.80.0070.05720.07
5.6.70.0030.05020.24
5.6.60.0100.07720.25
5.6.50.0100.03320.05
5.6.40.0070.08320.03
5.6.30.0030.03720.00
5.6.20.0030.08020.07
5.6.10.0030.07319.93
5.6.00.0030.03320.02
5.5.380.0030.08017.70
5.5.370.0070.07717.70
5.5.360.0070.07017.59
5.5.350.0100.07317.65
5.5.340.0000.03717.90
5.5.330.0070.06318.07
5.5.320.0070.05718.08
5.5.310.0030.04317.84
5.5.300.0030.04718.04
5.5.290.0070.08017.93
5.5.280.0030.05317.96
5.5.270.0000.05017.94
5.5.260.0070.03718.04
5.5.250.0030.03717.88
5.5.240.0070.05317.50
5.5.230.0000.04017.48
5.5.220.0000.04717.29
5.5.210.0000.04017.63
5.5.200.0100.07717.29
5.5.190.0030.03317.39
5.5.180.0070.08017.42
5.5.160.0070.07317.27
5.5.150.0000.08317.18
5.5.140.0100.06317.43
5.5.130.0030.08317.32
5.5.120.0000.04317.47
5.5.110.0070.06317.46
5.5.100.0030.03317.48
5.5.90.0070.07017.19
5.5.80.0070.03317.08
5.5.70.0000.08317.34
5.5.60.0030.03317.50
5.5.50.0030.05717.34
5.5.40.0070.07317.34
5.5.30.0030.06717.17
5.5.20.0030.04717.46
5.5.10.0030.03717.14
5.5.00.0100.03317.46
5.4.450.0030.05719.33
5.4.440.0000.07019.41
5.4.430.0030.07019.55
5.4.420.0070.04719.32
5.4.410.0130.06319.29
5.4.400.0070.08019.19
5.4.390.0130.04719.31
5.4.380.0070.08019.18
5.4.370.0000.06318.95
5.4.360.0030.07019.18
5.4.350.0030.05319.34
5.4.340.0070.05019.24
5.4.320.0000.03719.31
5.4.310.0070.07018.95
5.4.300.0100.07319.14
5.4.290.0070.03019.03
5.4.280.0130.06319.18
5.4.270.0100.07019.03
5.4.260.0130.04719.05
5.4.250.0100.03719.31
5.4.240.0100.06318.99
5.4.230.0000.04718.98
5.4.220.0030.07019.18
5.4.210.0170.03719.23
5.4.200.0070.03319.00
5.4.190.0000.04019.13
5.4.180.0070.04019.00
5.4.170.0100.05319.32
5.4.160.0100.04319.12
5.4.150.0000.04319.31
5.4.140.0070.03316.63
5.4.130.0030.04016.52
5.4.120.0030.07316.62
5.4.110.0000.06016.43
5.4.100.0000.05016.57
5.4.90.0100.02716.31
5.4.80.0100.02716.55
5.4.70.0070.04016.35
5.4.60.0030.07316.54
5.4.50.0030.03016.25
5.4.40.0130.02316.44
5.4.30.0030.05716.52
5.4.20.0000.03716.28
5.4.10.0070.03716.50
5.4.00.0030.03015.95
5.3.290.0070.07314.82
5.3.280.0070.04014.76
5.3.270.0070.05714.61
5.3.260.0070.05314.64
5.3.250.0030.03314.72
5.3.240.0030.03714.59
5.3.230.0030.05314.62
5.3.220.0070.07314.45
5.3.210.0070.07314.61
5.3.200.0070.05714.61
5.3.190.0070.03014.73
5.3.180.0030.04714.81
5.3.170.0030.05714.67
5.3.160.0030.07014.81
5.3.150.0000.03714.59
5.3.140.0000.03714.57
5.3.130.0030.03314.80
5.3.120.0000.05014.57
5.3.110.0070.03714.58
5.3.100.0000.05714.07
5.3.90.0000.08313.90
5.3.80.0100.06014.16
5.3.70.0070.07314.16
5.3.60.0100.07714.10
5.3.50.0070.03014.04
5.3.40.0070.05313.95
5.3.30.0000.07313.93
5.3.20.0030.06713.75
5.3.10.0070.06713.82
5.3.00.0070.06713.71
5.2.170.0100.06311.30
5.2.160.0000.02711.25
5.2.150.0100.02011.14
5.2.140.0070.04011.15
5.2.130.0030.02311.25
5.2.120.0000.06711.08
5.2.110.0100.04310.99
5.2.100.0100.05011.09
5.2.90.0070.03311.16
5.2.80.0070.05011.11
5.2.70.0070.06011.11
5.2.60.0000.06011.08
5.2.50.0000.03711.03
5.2.40.0070.06311.25
5.2.30.0000.03311.03
5.2.20.0070.04010.98
5.2.10.0070.05710.74
5.2.00.0070.03710.70
5.1.60.0000.0279.99
5.1.50.0000.0279.98
5.1.40.0100.0439.96
5.1.30.0030.02710.50
5.1.20.0030.03710.52
5.1.10.0030.02710.24
5.1.00.0000.02710.06
5.0.50.0000.0209.75
5.0.40.0070.0309.75
5.0.30.0000.0309.75
5.0.20.0030.0179.75
5.0.10.0000.0209.75
5.0.00.0030.0609.75
4.4.90.0000.0339.75
4.4.80.0000.0479.75
4.4.70.0070.0339.75
4.4.60.0030.0279.75
4.4.50.0000.0339.75
4.4.40.0000.0239.75
4.4.30.0030.0139.75
4.4.20.0000.0209.75
4.4.10.0030.0279.75
4.4.00.0000.0539.75
4.3.110.0000.0179.75
4.3.100.0000.0339.75
4.3.90.0030.0109.75
4.3.80.0070.0379.75
4.3.70.0000.0209.75
4.3.60.0030.0109.75
4.3.50.0000.0239.75
4.3.40.0070.0409.75
4.3.30.0070.0239.75
4.3.20.0000.0339.75
4.3.10.0000.0339.75
4.3.00.0030.0309.75

preferences:
63.19 ms | 401 KiB | 5 Q