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; } } gc_enable(); foreach (range(1, 50000) as $i) { $collection = new Collection(array( 'foo', 'bar' )); foreach ($collection as $item) { echo memory_get_usage() . "\n"; flush(); } unset($collection); } echo "done\n";

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.2.00.0040.01823.56
7.1.70.0060.00921.19
7.1.60.0040.01221.46
7.1.50.0200.01621.24
7.1.00.0030.08326.45
7.0.200.0330.00320.64
7.0.140.0170.07326.30
7.0.100.0300.08323.08
7.0.90.0200.08323.02
7.0.80.0200.08323.03
7.0.70.0070.09723.03
7.0.60.0100.09022.91
7.0.50.0300.06723.38
7.0.40.0130.05021.76
7.0.30.0100.08021.74
7.0.20.0230.05721.80
7.0.10.0070.08321.80
7.0.00.0230.08021.60
5.6.280.0070.09330.39
5.6.250.0330.06730.09
5.6.240.0130.08730.16
5.6.230.0130.09730.20
5.6.220.0270.08330.22
5.6.210.0170.09030.27
5.6.200.0170.10030.54
5.6.190.0070.09330.58
5.6.180.0100.08030.56
5.6.170.0070.10330.61
5.6.160.0170.09030.70
5.6.150.0100.09330.63
5.6.140.0070.08730.75
5.6.130.0170.05730.51
5.6.120.0200.07730.61
5.6.110.0200.07030.54
5.6.100.0170.06030.62
5.6.90.0230.09030.62
5.6.80.0130.08030.02
5.6.70.0170.08730.01
5.6.60.0200.08329.83
5.6.50.0170.09329.99
5.6.40.0200.08030.06
5.6.30.0170.08730.06
5.6.20.0270.08029.82
5.6.10.0130.09729.82
5.6.00.0100.06329.98
5.5.380.0230.08330.08
5.5.370.0230.08729.95
5.5.360.0200.08729.92
5.5.350.0130.09029.98
5.5.340.0070.08030.58
5.5.330.0330.08030.17
5.5.320.0200.08730.39
5.5.310.0100.09730.26
5.5.300.0170.09730.28
5.5.290.0130.10030.45
5.5.280.0230.09330.44
5.5.270.0130.08730.32
5.5.260.0200.07730.37
5.5.250.0170.09330.19
5.5.240.0200.09029.78
5.5.230.0130.08329.70
5.5.220.0230.08729.66
5.5.210.0200.09329.67
5.5.200.0100.06329.61
5.5.190.0030.10029.70
5.5.180.0200.05029.68
5.5.160.0230.07329.73
5.5.150.0130.07029.79
5.5.140.0230.08329.80
5.5.130.0100.09729.76
5.5.120.0130.09329.61
5.5.110.0130.06329.75
5.5.100.0170.09729.53
5.5.90.0200.07029.68
5.5.80.0100.10029.50
5.5.70.0170.05729.48
5.5.60.0370.04729.45
5.5.50.0200.08329.67
5.5.40.0300.08029.57
5.5.30.0330.07029.48
5.5.20.0270.08029.52
5.5.10.0200.08329.63
5.5.00.0370.07729.62
5.4.450.0000.11028.68
5.4.440.0230.07728.68
5.4.430.0100.09728.85
5.4.420.0270.07328.86
5.4.410.0130.09728.74
5.4.400.0130.08728.60
5.4.390.0300.08028.62
5.4.380.0230.08028.71
5.4.370.0230.08728.61
5.4.360.0170.09328.68
5.4.350.0270.07728.40
5.4.340.0200.08328.34
5.4.320.0230.08728.50
5.4.310.0230.09028.46
5.4.300.0100.09028.52
5.4.290.0100.06028.42
5.4.280.0170.09028.61
5.4.270.0170.05328.51
5.4.260.0200.05728.71
5.4.250.0130.05028.59
5.4.240.0130.06028.38
5.4.230.0170.08728.44
5.4.220.0130.08328.54
5.4.210.0230.08328.60
5.4.200.0130.08728.58
5.4.190.0230.07728.41
5.4.180.0130.08728.69
5.4.170.0170.07728.50
5.4.160.0100.09328.51
5.4.150.0230.08328.48
5.4.140.0200.08725.74
5.4.130.0070.09725.94
5.4.120.0170.06025.91
5.4.110.0100.05725.85
5.4.100.0170.09025.86
5.4.90.0170.06726.02
5.4.80.0130.08025.93
5.4.70.0130.09025.80
5.4.60.0170.08325.89
5.4.50.0130.08325.93
5.4.40.0170.08725.90
5.4.30.0200.07325.92
5.4.20.0130.08325.84
5.4.10.0170.06325.80
5.4.00.0200.08725.29
5.3.290.0070.10726.42
5.3.280.0270.08326.15
5.3.270.0170.08325.08
5.3.260.0270.08325.44
5.3.250.0230.08725.79
5.3.240.0200.06725.59
5.3.230.0200.07324.91
5.3.220.0270.08024.89
5.3.210.0330.08025.64
5.3.200.0130.09024.59
5.3.190.0100.06024.86
5.3.180.0170.09025.76
5.3.170.0070.09024.80
5.3.160.0230.08725.01
5.3.150.0270.07324.70
5.3.140.0230.08325.89
5.3.130.0130.09724.95
5.3.120.0170.08326.15
5.3.110.0170.08024.86
5.3.100.0170.09025.49
5.3.90.0230.08325.30
5.3.80.0170.08324.55
5.3.70.0070.05024.54
5.3.60.0330.07725.28
5.3.50.0230.08325.14
5.3.40.0200.08725.36
5.3.30.0330.07724.98
5.3.20.0130.09025.01
5.3.10.0230.04723.93
5.3.00.0130.09724.93

preferences:
36.14 ms | 400 KiB | 5 Q