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 $i . ': ' . 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.3.120.0130.01618.43
7.3.110.0130.02318.21
7.3.100.0330.02721.77
7.3.90.0220.02821.70
7.3.80.0160.03921.99
7.3.70.0130.02019.26
7.3.60.0290.02921.55
7.3.50.0230.03321.91
7.3.40.0200.00717.79
7.3.30.0390.02319.70
7.3.20.0220.01620.60
7.3.10.0140.02120.67
7.3.00.0190.02224.76
7.2.240.0130.04422.31
7.2.230.0000.03118.81
7.2.220.0110.04522.68
7.2.210.0100.02018.24
7.2.200.0130.03719.69
7.2.190.0100.04322.53
7.2.180.0170.01718.71
7.2.170.0140.04622.48
7.2.160.0140.04122.13
7.2.150.0140.02920.88
7.2.140.0130.02020.79
7.2.130.0140.01721.14
7.2.120.0070.01721.21
7.2.110.0200.03321.21
7.2.100.0100.01620.89
7.2.90.0280.01421.13
7.2.80.0150.02121.23
7.2.70.0130.01920.84
7.2.60.0170.01723.26
7.2.50.0100.04325.33
7.2.40.0220.01621.13
7.2.30.0180.00921.25
7.2.20.0200.01720.98
7.2.10.0130.03323.17
7.2.00.0160.02224.52
7.1.330.0070.02319.86
7.1.320.0170.02424.05
7.1.310.0100.01919.77
7.1.300.0200.03722.14
7.1.290.0100.01619.66
7.1.280.0030.03219.81
7.1.270.0100.02820.05
7.1.260.0130.01720.02
7.1.250.0210.02721.70
7.1.70.0030.01620.97
7.1.60.0270.03425.71
7.1.50.0130.02920.92
7.0.200.0100.02324.82

preferences:
38.95 ms | 401 KiB | 5 Q