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($objOrArr)) { $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.0170.00318.56
8.3.50.0070.00921.21
8.3.40.0070.01419.09
8.3.30.0070.00720.39
8.3.20.0040.00420.13
8.3.10.0000.00821.21
8.3.00.0090.00022.18
8.2.180.0290.00316.75
8.2.170.0040.01122.96
8.2.160.0070.00722.01
8.2.150.0000.00824.18
8.2.140.0000.00724.66
8.2.130.0020.00526.16
8.2.120.0000.00820.79
8.2.110.0000.00922.16
8.2.100.0110.00018.16
8.2.90.0050.00319.22
8.2.80.0090.00019.32
8.2.70.0090.00017.75
8.2.60.0060.00317.93
8.2.50.0040.00418.07
8.2.40.0050.00318.34
8.2.30.0000.00719.33
8.2.20.0000.00717.88
8.2.10.0040.00418.05
8.2.00.0000.00818.03
8.1.280.0070.01125.92
8.1.270.0040.00423.99
8.1.260.0110.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.79
8.1.230.0060.00619.03
8.1.220.0040.00417.80
8.1.210.0040.00418.77
8.1.200.0090.00017.47
8.1.190.0040.00417.66
8.1.180.0050.00318.10
8.1.170.0000.00818.57
8.1.160.0000.00718.95
8.1.150.0040.00418.82
8.1.140.0050.00217.57
8.1.130.0030.00517.91
8.1.120.0000.00817.65
8.1.110.0050.00217.67
8.1.100.0000.00817.67
8.1.90.0030.00517.57
8.1.80.0000.00717.56
8.1.70.0030.00317.60
8.1.60.0030.00617.73
8.1.50.0040.00417.63
8.1.40.0000.00817.61
8.1.30.0000.00817.66
8.1.20.0000.00817.82
8.1.10.0000.00817.73
8.1.00.0030.00517.77
8.0.300.0040.00418.77
8.0.290.0080.00017.30
8.0.280.0000.00718.53
8.0.270.0000.00717.34
8.0.260.0030.00317.13
8.0.250.0070.00017.19
8.0.240.0060.00317.09
8.0.230.0000.00817.22
8.0.220.0080.00017.20
8.0.210.0050.00317.21
8.0.200.0000.00617.11
8.0.190.0030.00617.21
8.0.180.0000.00717.09
8.0.170.0000.00917.07
8.0.160.0040.00417.16
8.0.150.0050.00317.18
8.0.140.0030.00617.02
8.0.130.0060.00313.57
8.0.120.0080.00017.05
8.0.110.0040.00417.14
8.0.100.0000.00717.14
8.0.90.0030.00517.11
8.0.80.0090.00617.05
8.0.70.0040.00416.96
8.0.60.0000.00817.04
8.0.50.0070.00017.03
8.0.30.0150.00317.30
8.0.20.0150.00817.41
8.0.10.0000.00717.34
8.0.00.0070.01216.79
7.4.330.0050.00016.77
7.4.320.0040.00416.79
7.4.300.0030.00316.60
7.4.290.0040.00416.55
7.4.280.0070.00016.64
7.4.270.0040.00316.55
7.4.260.0050.00013.34
7.4.250.0040.00416.71
7.4.240.0020.00516.62
7.4.230.0030.00316.77
7.4.220.0070.01116.86
7.4.210.0080.00816.79
7.4.200.0050.00216.85
7.4.190.0000.00716.70
7.4.160.0180.00416.92
7.4.150.0030.01417.40
7.4.140.0100.01017.86
7.4.130.0080.00916.71
7.4.120.0130.00316.69
7.4.110.0070.01116.73
7.4.100.0050.01316.57
7.4.90.0030.01516.71
7.4.80.0130.00719.39
7.4.70.0160.00016.72
7.4.60.0090.00916.64
7.4.50.0040.00416.80
7.4.40.0100.00522.77
7.4.30.0100.00916.80
7.4.00.0060.01015.26
7.3.330.0000.00513.51
7.3.320.0000.00513.44
7.3.310.0070.00016.38
7.3.300.0030.00316.51
7.3.290.0140.00016.58
7.3.280.0100.00616.52
7.3.270.0150.00317.40
7.3.260.0130.00618.24
7.3.250.0110.00916.64
7.3.240.0150.00316.59
7.3.230.0060.01216.70
7.3.210.0100.00716.39
7.3.200.0130.01019.39
7.3.190.0090.01316.52
7.3.180.0030.01316.64
7.3.170.0150.00916.70
7.3.160.0090.00616.65
7.3.120.0080.00815.06
7.2.330.0090.00916.60
7.2.320.0130.00416.57
7.2.310.0080.01516.99
7.2.300.0120.00916.98
7.2.290.0100.00716.98
7.2.60.0100.00316.79
7.2.00.0060.00619.39
7.1.200.0080.00416.07
7.1.100.0030.01318.40
7.1.70.0000.00717.28
7.1.60.0030.02019.17
7.1.50.0250.00935.04
7.1.00.0070.03022.40
7.0.200.0000.00716.64
7.0.140.0070.07022.04
7.0.60.0070.08319.93
7.0.50.0030.04017.97
7.0.40.0070.04320.41
7.0.30.0300.08320.11
7.0.20.0270.04720.15
7.0.10.0070.05020.33
7.0.00.0100.07720.02
5.6.280.0000.07720.82
5.6.210.0070.08720.63
5.6.200.0170.04018.15
5.6.190.0070.08320.60
5.6.180.0330.04020.33
5.6.170.0270.08020.54
5.6.160.0030.08320.54
5.6.150.0000.05318.23
5.6.140.0070.06018.24
5.6.130.0000.04718.28
5.6.120.0070.06721.14
5.6.110.0130.08021.05
5.6.100.0000.05020.94
5.6.90.0100.08020.97
5.6.80.0070.06720.49
5.5.350.2000.03720.31
5.5.340.0100.06718.09
5.5.330.0100.08020.31
5.5.320.0200.08320.29
5.5.310.0230.05320.41
5.5.300.0070.03718.06
5.5.290.0100.04317.94
5.5.280.0100.07720.76
5.5.270.0130.08320.76
5.5.260.0100.05720.87
5.5.250.0070.05020.68
5.5.240.0100.05320.34
5.4.450.1500.04019.55
5.4.440.1530.03719.19
5.4.430.1470.04319.07
5.4.420.1630.04719.18
5.4.410.1630.04019.51
5.4.400.1470.04319.03
5.4.390.1500.04018.78
5.4.380.1530.04319.08
5.4.370.0030.03718.98
5.4.360.0200.03319.03
5.4.350.1530.02719.11
5.4.340.1530.03719.10
5.4.320.1530.03719.16
5.4.310.1530.03318.75
5.4.300.1730.04319.34
5.4.290.1470.04319.31
5.4.280.1870.03718.90
5.4.270.1870.03319.20
5.4.260.1800.05018.78
5.4.250.1770.03718.85
5.4.240.1600.03718.89
5.4.230.1470.03319.11
5.4.220.0000.06719.20
5.4.210.0030.04718.77
5.4.200.0870.05319.16
5.4.190.1530.04019.16
5.4.180.1330.03718.90
5.4.170.1500.04318.99
5.4.160.1970.04019.20
5.4.150.1600.05019.19
5.4.140.1630.04016.73
5.4.130.1570.03716.45
5.4.120.1900.03716.38
5.4.110.1600.03316.45
5.4.100.1570.03716.42
5.4.90.1600.03716.58
5.4.80.0500.03716.57
5.4.70.0030.03716.59
5.4.60.0130.04716.48
5.4.50.1800.04016.57
5.4.40.1530.03316.38
5.4.30.1500.04016.50
5.4.20.1630.03316.37
5.4.10.1530.03316.52
5.4.00.1500.04015.95
5.3.290.1830.04714.57
5.3.280.1870.04714.57
5.3.270.1900.04714.76
5.3.260.1870.04014.59
5.3.250.1470.03314.62
5.3.240.1230.03714.65
5.3.230.0070.07714.60
5.3.220.0070.05014.50
5.3.210.1030.05314.49
5.3.200.1430.03714.56
5.3.190.1530.03314.59
5.3.180.1730.04314.72
5.3.170.1770.04314.63
5.3.160.1770.03714.58
5.3.150.1600.03714.54
5.3.140.1770.04714.68
5.3.130.1800.05014.65
5.3.120.1730.05014.64
5.3.110.1770.04314.70
5.3.100.0800.04014.04
5.3.90.0070.06714.14
5.3.80.0070.03314.14
5.3.70.1100.04314.25
5.3.60.1800.04014.00
5.3.50.1670.03714.05
5.3.40.1730.04713.97
5.3.30.1670.04013.93
5.3.20.1570.03713.76
5.3.10.1730.03013.57
5.3.00.1470.04013.87
5.2.170.1330.03311.07
5.2.160.1270.02711.25
5.2.150.1500.03011.08
5.2.140.1270.02711.13
5.2.130.1200.03711.03
5.2.120.0030.06311.20
5.2.110.0030.03311.02
5.2.100.0030.05011.02
5.2.90.1530.03011.34
5.2.80.1300.02311.18
5.2.70.1470.04011.01
5.2.60.1430.04310.96
5.2.50.1300.03711.12
5.2.40.1070.03011.25
5.2.30.1230.03711.21
5.2.20.1100.02710.89
5.2.10.0930.03310.84
5.2.00.1030.03310.80
5.1.60.1030.02710.01
5.1.50.1200.02310.09
5.1.40.1270.02310.11
5.1.30.1230.02310.39
5.1.20.0800.03310.36
5.1.10.0070.04310.06
5.1.00.0000.05310.05
5.0.50.0070.0208.45
5.0.40.0000.0208.40
5.0.30.0030.0638.39
5.0.20.0600.0238.29
5.0.10.0530.0208.11
5.0.00.0530.0308.15
4.4.90.0500.0177.77
4.4.80.0630.0177.77
4.4.70.0570.0107.77
4.4.60.0630.0177.77
4.4.50.0600.0237.77
4.4.40.0570.0207.77
4.4.30.0530.0137.77
4.4.20.0600.0177.77
4.4.10.0600.0207.77
4.4.00.0630.0307.77
4.3.110.0600.0177.77
4.3.100.0570.0207.77
4.3.90.0630.0177.77
4.3.80.0530.0207.77
4.3.70.0530.0137.77
4.3.60.0530.0177.77
4.3.50.0530.0137.77
4.3.40.0500.0237.77
4.3.30.0270.0207.77
4.3.20.0230.0177.77
4.3.10.0270.0177.77
4.3.00.0270.0177.77

preferences:
33.84 ms | 401 KiB | 5 Q