3v4l.org

run code in 300+ PHP versions simultaneously
<?php class values implements IteratorAggregate { protected $iterator = null; protected $data = null; public function __construct($data) { $this->data = $data; } public function getIterator() { if (null === $this->iterator){ if(is_array($this->data)) { $this->iterator = new ArrayObject($this->data); } else if(is_object($this->data)) { $this->iterator = new ArrayObject(get_object_vars($this->data)); } else { throw new Exception('$objOrArray is neither an array or an object'); } } return $this->iterator; } } $values = new values(new DateTime()); for ($i = 0; $i < 100; $i++){ foreach($values as $k => $v) { var_dump($k, $v); } }

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.0030.01718.56
8.3.50.0100.00318.20
8.3.40.0000.01518.80
8.3.30.0070.00719.13
8.3.20.0040.00420.21
8.3.10.0050.00323.66
8.3.00.0000.00820.75
8.2.180.0070.01316.48
8.2.170.0070.00722.96
8.2.160.0140.00020.52
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0110.00726.16
8.2.120.0030.00619.61
8.2.110.0090.01222.27
8.2.100.0070.00420.52
8.2.90.0030.00519.27
8.2.80.0000.00817.97
8.2.70.0090.00017.75
8.2.60.0070.00417.66
8.2.50.0000.00918.07
8.2.40.0070.00318.16
8.2.30.0070.00018.43
8.2.20.0050.00317.77
8.2.10.0050.00318.11
8.2.00.0040.00417.89
8.1.280.0130.00925.92
8.1.270.0050.00323.87
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0040.00823.87
8.1.230.0000.01019.09
8.1.220.0040.00417.89
8.1.210.0040.00418.77
8.1.200.0040.00417.48
8.1.190.0080.00017.48
8.1.180.0050.00318.10
8.1.170.0030.00618.68
8.1.160.0040.00421.95
8.1.150.0030.00518.85
8.1.140.0000.00717.66
8.1.130.0000.00717.97
8.1.120.0030.00317.72
8.1.110.0070.00017.57
8.1.100.0040.00417.56
8.1.90.0070.00017.68
8.1.80.0000.00717.64
8.1.70.0000.00717.55
8.1.60.0080.00417.61
8.1.50.0040.00417.64
8.1.40.0000.01117.70
8.1.30.0030.00517.73
8.1.20.0030.00517.68
8.1.10.0000.00717.71
8.1.00.0050.00317.77
8.0.300.0070.00018.77
8.0.290.0040.00416.88
8.0.280.0070.00018.48
8.0.270.0030.00317.38
8.0.260.0030.00517.27
8.0.250.0000.00817.05
8.0.240.0000.00717.06
8.0.230.0030.00317.10
8.0.220.0000.00817.10
8.0.210.0030.00317.03
8.0.200.0040.00417.16
8.0.190.0080.00017.17
8.0.180.0050.00316.99
8.0.170.0080.00017.12
8.0.160.0000.00716.91
8.0.150.0000.00717.04
8.0.140.0050.00217.10
8.0.130.0030.00313.50
8.0.120.0000.00817.07
8.0.110.0050.00216.92
8.0.100.0040.00417.13
8.0.90.0040.00417.12
8.0.80.0030.01717.16
8.0.70.0000.00716.99
8.0.60.0000.00717.01
8.0.50.0000.00716.94
8.0.30.0060.01317.18
8.0.20.0100.01017.40
8.0.10.0000.00717.09
8.0.00.0120.00816.79
7.4.330.0030.00315.21
7.4.320.0000.00616.75
7.4.300.0040.00416.64
7.4.290.0000.00716.63
7.4.280.0040.00416.74
7.4.270.0050.00216.67
7.4.260.0000.00716.53
7.4.250.0060.00316.61
7.4.240.0060.00116.65
7.4.230.0030.00316.56
7.4.220.0080.01116.54
7.4.210.0100.01016.58
7.4.200.0070.00016.72
7.4.160.0130.00316.50
7.4.150.0150.00417.40
7.4.140.0080.00917.86
7.4.130.0110.00616.70
7.4.120.0120.00716.79
7.4.110.0070.01016.96
7.4.100.0120.01216.73
7.4.90.0090.00916.55
7.4.80.0140.00619.39
7.4.70.0110.00516.81
7.4.60.0080.00916.82
7.4.50.0060.00016.60
7.4.40.0120.00316.61
7.4.30.0060.00916.61
7.4.00.0030.01414.92
7.3.330.0020.00513.23
7.3.320.0000.00613.38
7.3.310.0050.00216.34
7.3.300.0040.00416.31
7.3.290.0000.01716.45
7.3.280.0130.01116.44
7.3.270.0120.01517.40
7.3.260.0240.00016.45
7.3.250.0140.01316.67
7.3.240.0150.00816.83
7.3.230.0120.01216.66
7.3.210.0130.01016.74
7.3.200.0080.01119.39
7.3.190.0030.01816.49
7.3.180.0070.01716.53
7.3.170.0160.00616.62
7.3.160.0120.01016.42
7.3.120.0090.01214.94
7.2.330.0160.00816.91
7.2.320.0190.00617.05
7.2.310.0130.01016.95
7.2.300.0190.00416.85
7.2.290.0140.01416.72
7.2.60.0170.01116.52
7.1.200.0040.01415.84
7.1.70.0100.00317.30
7.1.60.0000.02519.70
7.1.50.0180.01116.88
7.0.200.0000.01116.63
5.4.450.1770.04319.35
5.4.440.1770.04719.57
5.4.430.1470.04019.27
5.4.420.1830.04719.38
5.4.410.1570.03719.20
5.4.400.1870.04019.16
5.4.390.1400.04719.13
5.4.380.1530.03719.15
5.4.370.1570.05019.22
5.4.360.1500.04319.14
5.4.350.1570.03719.22
5.4.340.1530.04018.98
5.4.320.1570.03319.09
5.4.310.1570.03318.95
5.4.300.1770.04719.19
5.4.290.1770.04719.17
5.4.280.1830.03719.21
5.4.270.1570.04019.21
5.4.260.1600.03718.99
5.4.250.1730.03319.23
5.4.240.1770.03318.97
5.4.230.1630.03019.12
5.4.220.1600.03718.86
5.4.210.1530.04018.82
5.4.200.1630.03319.09
5.4.190.1670.03318.98
5.4.180.1570.03319.23
5.4.170.1770.05019.14
5.4.160.1830.04319.05
5.4.150.1800.05319.16
5.4.140.1500.03716.37
5.4.130.1670.04016.33
5.4.120.1530.03016.50
5.4.110.1730.04316.61
5.4.100.1800.03716.63
5.4.90.1430.03716.59
5.4.80.1600.04716.55
5.4.70.1630.05016.50
5.4.60.1870.03316.43
5.4.50.1670.04716.32
5.4.40.1800.04016.43
5.4.30.1770.03716.42
5.4.20.1730.04716.16
5.4.10.1500.03716.55
5.4.00.1500.03316.00
5.3.290.1730.05014.69
5.3.280.1630.03714.69
5.3.270.1570.03014.70
5.3.260.1630.05314.63
5.3.250.2000.04314.60
5.3.240.2030.04314.67
5.3.230.1800.03714.69
5.3.220.2000.04714.72
5.3.210.1970.04314.80
5.3.200.2000.03714.55
5.3.190.2100.04314.55
5.3.180.2030.04714.66
5.3.170.1730.03714.65
5.3.160.1700.04014.55
5.3.150.1870.04014.80
5.3.140.2070.04714.46
5.3.130.1670.04714.68
5.3.120.2100.04314.57
5.3.110.2100.04314.78
5.3.100.2100.04013.96
5.3.90.2100.03714.05
5.3.80.2100.03714.03
5.3.70.2000.03314.17
5.3.60.1900.04314.02
5.3.50.1600.03014.19
5.3.40.1700.04313.88
5.3.30.1700.03013.98
5.3.20.1770.05013.71
5.3.10.1600.03713.89
5.3.00.1700.03713.76

preferences:
41.2 ms | 400 KiB | 5 Q