3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Collection extends ArrayObject { protected $iterator; public function getIterator() { // Well, this is a heavy object to make, let's memoize it if (!isset($this->iterator)) { $this->iterator = new ArrayIterator($this); } return $this->iterator; } } function foo() { $collection = new Collection(array( 'foo', 'bar' )); foreach ($collection as $item) { break; } unset($collection); } gc_enable(); $base = memory_get_usage(); foreach (range(1, 250000) as $i) { foo(); gc_collect_cycles(); if ($i % 500 === 0) { var_dump(memory_get_usage() - $base); } }

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.3.10.0300.29324.16
7.3.00.0770.29224.32
7.2.130.0330.35024.68
7.2.120.0400.34124.55
7.2.110.0330.34824.55
7.2.100.0200.33124.14
7.2.90.0170.32924.64
7.2.80.0260.33224.03
7.2.70.0270.34524.40
7.2.60.0270.36724.61
7.2.50.0360.32224.59
7.2.40.0490.33724.59
7.2.30.0310.36524.53
7.2.20.0470.35324.50
7.2.10.0200.34824.67
7.2.00.0160.29725.61
7.1.250.0070.44823.15
7.1.70.0030.23725.00
7.1.60.0070.29725.02
7.1.50.0070.24824.89
7.1.00.0030.37330.36
7.0.200.0030.26924.31
7.0.140.0130.34730.06
7.0.100.0100.32327.41
7.0.90.0170.32027.63
7.0.80.0130.37727.43
7.0.70.0270.30027.37
7.0.60.0130.33727.40
7.0.50.0330.31329.53
7.0.40.0100.38727.58
7.0.30.0130.31727.65
7.0.20.0130.28027.59
7.0.10.0130.34727.46
7.0.00.0100.39027.62
5.6.280.0100.54755.56
5.6.250.0200.47755.41
5.6.240.0370.45755.30
5.6.230.0200.44055.33
5.6.220.0330.11084.50
5.6.210.0230.15784.68
5.6.200.0400.19385.03
5.6.190.0330.17385.07
5.6.180.0400.14084.86
5.6.170.0330.18385.02
5.6.160.0370.17084.93
5.6.150.0330.18384.93
5.6.140.0530.12084.96
5.6.130.0270.14384.95
5.6.120.0470.12084.79
5.6.110.0300.18784.94
5.6.100.0330.13384.97
5.6.90.0500.16085.00
5.6.80.0170.13084.39
5.6.70.0270.16084.38
5.6.60.0170.18784.35
5.6.50.0300.09784.43
5.6.40.0430.15084.37
5.6.30.0170.13784.32
5.6.20.0370.16784.27
5.6.10.0400.19384.27
5.6.00.0300.11784.21
5.5.380.0170.47355.17
5.5.370.0200.45755.36
5.5.360.0300.17384.27
5.5.350.0400.11084.33
5.5.340.0230.16784.82
5.5.330.0430.18084.74
5.5.320.0300.10784.68
5.5.310.0300.13784.81
5.5.300.0170.17084.82
5.5.290.0270.17784.73
5.5.280.0370.19084.64
5.5.270.0370.16084.76
5.5.260.0100.12784.73
5.5.250.0400.15784.60
5.5.240.0370.14084.20
5.5.230.0330.18084.20
5.5.220.0400.13084.16
5.5.210.0500.13084.14
5.5.200.0430.09384.14
5.5.190.0530.10384.07
5.5.180.0330.19084.00
5.5.160.0170.18783.88
5.5.150.0300.16084.05
5.5.140.0430.17784.05
5.5.130.0430.14384.01
5.5.120.0230.12383.98
5.5.110.0270.13784.02
5.5.100.0330.13383.85
5.5.90.0200.17783.97
5.5.80.0400.17383.99
5.5.70.0170.15083.96
5.5.60.0330.16083.86
5.5.50.0300.10084.06
5.5.40.0130.12383.87
5.5.30.0430.16383.99
5.5.20.0230.11384.04
5.5.10.0230.16383.85
5.5.00.0230.16383.91
5.4.450.0330.13783.14
5.4.440.0330.13383.41
5.4.430.0270.13383.17
5.4.420.0300.14783.14
5.4.410.0300.15083.12
5.4.400.0330.13782.79
5.4.390.0200.17383.02
5.4.380.0370.13383.05
5.4.370.0230.13082.87
5.4.360.0430.14782.93
5.4.350.0130.14782.79
5.4.340.0230.17782.88
5.4.320.0400.14382.78
5.4.310.0370.09082.92
5.4.300.0230.11782.86
5.4.290.0330.15082.87
5.4.280.0570.13782.88
5.4.270.0370.14782.87
5.4.260.0300.15382.84
5.4.250.0370.14382.87
5.4.240.0330.14082.86
5.4.230.0370.10082.85
5.4.220.0270.15382.93
5.4.210.0300.16782.88
5.4.200.0170.16782.72
5.4.190.0370.13382.84
5.4.180.0300.14082.78
5.4.170.0330.10082.86
5.4.160.0300.16383.02
5.4.150.0370.16083.00
5.4.140.0270.15380.26
5.4.130.0130.12780.22
5.4.120.0230.14780.18
5.4.110.0130.13080.23
5.4.100.0230.11780.21
5.4.90.0270.12080.39
5.4.80.0300.09380.29
5.4.70.0170.11080.37
5.4.60.0230.10380.17
5.4.50.0230.11080.16
5.4.40.0300.09780.20
5.4.30.0330.09380.28
5.4.20.0200.11080.31
5.4.10.0130.11380.27
5.4.00.0300.10079.52
5.3.290.0370.14375.96
5.3.280.0400.09776.06
5.3.270.0200.12075.99
5.3.260.0130.14075.85
5.3.250.0200.14375.96
5.3.240.0370.16075.86
5.3.230.0330.17075.98
5.3.220.0270.12375.82
5.3.210.0330.11075.87
5.3.200.0270.11375.82
5.3.190.0130.11375.82
5.3.180.0300.10075.95
5.3.170.0130.12375.96
5.3.160.0230.16375.94
5.3.150.0370.09375.91
5.3.140.0130.11375.97
5.3.130.0230.08776.00
5.3.120.0130.11376.06
5.3.110.0130.09775.95
5.3.100.0200.09075.50
5.3.90.0100.13075.36
5.3.80.0200.12775.32
5.3.70.0230.08775.93
5.3.60.0270.09375.45
5.3.50.0270.12075.39
5.3.40.0230.08775.29
5.3.30.0430.08775.75
5.3.20.0330.07775.02
5.3.10.0072.45348.41
5.3.00.0172.41748.42
5.2.170.0000.03011.22
5.2.160.0070.02011.19
5.2.150.0070.02011.28
5.2.140.0030.02311.24
5.2.130.0000.03011.15
5.2.120.0030.02311.12
5.2.110.0000.03010.98
5.2.100.0030.06311.11
5.2.90.0000.05711.25
5.2.80.0130.05711.02
5.2.70.0070.05011.13
5.2.60.0030.06310.95
5.2.50.0100.05711.16
5.2.40.0070.06011.07
5.2.30.0030.06310.92
5.2.20.0030.06310.92
5.2.10.0130.05010.73
5.2.00.0030.05710.84
5.1.60.0130.04010.10
5.1.50.0070.0439.84
5.1.40.0030.0439.82
5.1.30.0000.04010.45
5.1.20.0070.05310.50
5.1.10.0000.05310.15
5.1.00.0030.05710.20
5.0.50.0070.0438.98
5.0.40.0030.0178.98
5.0.30.0030.0608.98
5.0.20.0030.0408.98
5.0.10.0000.0408.98
5.0.00.0070.0578.98
4.4.90.0100.0278.98
4.4.80.0070.0338.98
4.4.70.0000.0408.98
4.4.60.0030.0338.98
4.4.50.0030.0378.98
4.4.40.0000.0408.98
4.4.30.0000.0408.98
4.4.20.0030.0378.98
4.4.10.0000.0208.98
4.4.00.0030.0308.98
4.3.110.0000.0178.98
4.3.100.0030.0278.98
4.3.90.0000.0238.98
4.3.80.0000.0378.98
4.3.70.0000.0378.98
4.3.60.0030.0208.98
4.3.50.0070.0308.98
4.3.40.0070.0478.98
4.3.30.0030.0208.98
4.3.20.0000.0178.98
4.3.10.0030.0378.98
4.3.00.0000.0238.98

preferences:
37.59 ms | 400 KiB | 5 Q