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)); $storage->rewind(); $iterated = 0; $expected = count($storage); while ($storage->valid()) { $iterated++; $object = $storage->current(); //echo $iterated . '(' . $object->val . ') - '; $storage->next(); foreach (range(1, 10) as $number) { if(rand(1,10) == $number) { // echo ' ' . $object->val . ' '; $storage->detach($object); unset($storage[$object]); continue; } } // echo PHP_EOL; } if(count($storage) != $expected) { echo 'Error!' . PHP_EOL; } exit;

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)
7.1.70.0030.00617.19
7.1.60.0070.00417.18
7.1.50.0030.00917.08
7.1.40.0070.00416.59
7.1.30.0040.00716.52
7.1.20.0080.00316.56
7.1.10.0040.00716.53
7.1.00.0030.01016.71
7.0.200.0000.01016.78
7.0.190.0000.00716.73
7.0.180.0060.00316.02
7.0.170.0040.00416.25
7.0.160.0040.00416.15
7.0.150.0000.00816.29
7.0.140.0000.00916.18
7.0.130.0180.00716.52
7.0.120.0000.00916.65
7.0.110.0060.00616.27
7.0.100.0040.00716.54
7.0.90.0040.00416.34
7.0.80.0000.00916.48
7.0.70.0030.00716.30
7.0.60.0040.00416.38
7.0.50.0040.00816.30
7.0.40.0060.00615.93
7.0.30.0080.00015.93
7.0.20.0030.00615.93
7.0.10.0000.00815.93
7.0.00.0080.00015.93
5.6.300.0000.04420.60
5.6.290.0000.04420.84
5.6.280.0070.03921.09
5.6.270.0070.04021.06
5.6.260.0070.04120.99
5.6.250.0000.04721.01
5.6.240.0070.04620.96
5.6.230.0070.03720.81
5.6.220.0000.05320.82
5.6.210.0100.03620.64
5.6.200.0070.05721.05
5.6.190.0030.04420.95
5.6.180.0060.04920.85
5.6.170.0030.04420.84
5.6.160.0070.03721.04
5.6.150.0030.04121.01
5.6.140.0000.04521.00
5.6.130.0070.04920.94
5.6.120.0110.03920.83
5.6.110.0060.03820.84
5.6.100.0030.04620.86
5.6.90.0070.04021.02
5.6.80.0000.04320.36
5.6.70.0070.03720.16
5.6.60.0000.04620.23
5.6.50.0000.04020.22
5.6.40.0030.04320.21
5.6.30.0070.04620.23
5.6.20.0000.04520.40
5.6.10.0130.02820.20
5.6.00.0070.03920.18
5.5.380.0030.04117.63
5.5.370.0030.03817.63
5.5.360.0070.03817.62
5.5.350.0000.04117.62
5.5.340.0070.03918.07
5.5.330.0100.03218.13
5.5.320.0000.04518.02
5.5.310.0000.04518.04
5.5.300.0030.04418.06
5.5.290.0030.04318.13
5.5.280.0030.04917.84
5.5.270.0030.04217.85
5.5.260.0000.05017.74
5.5.250.0140.04417.82
5.5.240.0030.03717.42
5.5.230.0030.04817.50
5.5.220.0070.04017.24
5.5.210.0030.03817.44
5.5.200.0030.03917.39
5.5.190.0000.04117.45
5.5.180.0030.03817.19
5.5.160.0070.03917.48
5.5.150.0070.03317.53
5.5.140.0000.08517.05
5.5.130.0030.05317.44
5.5.120.0000.04417.36
5.5.110.0000.04017.44
5.5.100.0030.03917.38
5.5.90.0060.03517.38
5.5.80.0100.03317.33
5.5.70.0070.04317.33
5.5.60.0030.04017.08
5.5.50.0070.04217.33
5.5.40.0000.04317.33
5.5.30.0070.03717.33
5.5.20.0000.04217.36
5.5.10.0000.04416.98
5.5.00.0030.04516.98
5.4.450.0000.05119.32
5.4.440.0100.03919.35
5.4.430.0030.04519.30
5.4.420.0070.03719.27
5.4.410.0030.04519.11
5.4.400.0070.03319.21
5.4.390.0100.03519.16
5.4.380.0030.03618.92
5.4.370.0030.03819.06
5.4.360.0070.03818.98
5.4.350.0070.03318.94
5.4.340.0030.04219.16
5.4.320.0030.04219.23
5.4.310.0000.03919.23
5.4.300.0040.03519.16
5.4.290.0030.04319.11
5.4.280.0060.04219.06
5.4.270.0070.03719.08
5.4.260.0000.04219.05
5.4.250.0030.04519.06
5.4.240.0060.03219.22
5.4.230.0030.03918.97
5.4.220.0030.04119.06
5.4.210.0000.05519.13
5.4.200.0060.03519.06
5.4.190.0060.03819.22
5.4.180.0070.03319.07
5.4.170.0000.05719.12
5.4.160.0030.03819.22
5.4.150.0030.03719.19
5.4.140.0030.04016.75
5.4.130.0000.05416.49
5.4.120.0000.04416.45
5.4.110.0000.03916.48
5.4.100.0070.03116.73
5.4.90.0030.03516.72
5.4.80.0000.03816.39
5.4.70.0030.06116.71
5.4.60.0030.03916.68
5.4.50.0000.04016.61
5.4.40.0200.04416.80
5.4.30.0030.03516.67
5.4.20.0030.03416.67
5.4.10.0030.03916.71
5.4.00.0030.03516.13
5.3.290.0000.04415.93
5.3.280.0030.03515.93
5.3.270.0000.04015.93
5.3.260.0030.04315.93
5.3.250.0000.04215.93
5.3.240.0000.04115.93
5.3.230.0030.04115.93
5.3.220.0000.04115.93
5.3.210.0000.04015.93
5.3.200.0000.03815.93
5.3.190.0060.04815.93
5.3.180.0000.03815.93
5.3.170.0000.04015.93
5.3.160.0030.03515.93
5.3.150.0030.03915.93
5.3.140.0000.03815.93
5.3.130.0070.03915.93
5.3.120.0030.04315.93
5.3.110.0070.03215.93
5.3.100.0030.03815.93
5.3.90.0100.05415.93
5.3.80.0000.06715.93
5.3.70.0030.04015.93
5.3.60.0000.03815.93
5.3.50.0030.05615.93
5.3.40.0060.03115.93
5.3.30.0070.05615.93
5.3.20.0000.05315.93
5.3.10.0030.03715.93
5.3.00.0000.03715.93

preferences:
34.69 ms | 400 KiB | 5 Q