3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyIter implements Iterator { private $a; private $key = 0; public function __construct(array $a) { $this->a = array_values($a); } public function key() { return $this->key; } public function rewind() { $this->key = 0; } public function valid() { echo __METHOD__, PHP_EOL; return isset($this->a[$this->key]); } public function next() { echo __METHOD__, PHP_EOL; $this->key++; } public function current() { echo __METHOD__, PHP_EOL; return $this->a[$this->key]; } } $ilist = new MyIter(array('A', 'B', 'C', 'D')); foreach ($ilist as $var) { echo "var = $var\n"; echo "current = ", print_r(current($ilist), true), "\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)
8.3.60.0160.00316.50
8.3.50.0100.00821.90
8.3.40.0120.00319.01
8.3.30.0090.00619.25
8.3.20.0040.00420.27
8.3.10.0040.00423.36
8.3.00.0060.00320.84
8.2.180.0040.01118.34
8.2.170.0090.00922.96
8.2.160.0070.00720.43
8.2.150.0030.00524.18
8.2.140.0080.00024.66
8.2.130.0100.01026.16
8.2.120.0040.00422.31
8.2.110.0030.00622.25
8.2.100.0060.00617.84
8.2.90.0040.00418.09
8.2.80.0030.00517.97
8.2.70.0100.00017.47
8.2.60.0100.00018.03
8.2.50.0030.00518.07
8.2.40.0000.00718.16
8.2.30.0050.00518.20
8.2.20.0000.00717.87
8.2.10.0080.00017.76
8.2.00.0040.00417.74
8.1.280.0040.01125.92
8.1.270.0060.00322.19
8.1.260.0030.00526.35
8.1.250.0000.00828.09
8.1.240.0050.00522.42
8.1.230.0070.00421.03
8.1.220.0040.00417.78
8.1.210.0000.00818.96
8.1.200.0030.00617.35
8.1.190.0000.00717.65
8.1.180.0000.00918.10
8.1.170.0040.00418.37
8.1.160.0080.00022.03
8.1.150.0070.00018.59
8.1.140.0070.00017.52
8.1.130.0000.00317.84
8.1.120.0030.00417.46
8.1.110.0040.00417.48
8.1.100.0040.00417.36
8.1.90.0040.00417.38
8.1.80.0070.00017.53
8.1.70.0050.00217.40
8.1.60.0000.00817.50
8.1.50.0060.00317.54
8.1.40.0030.00617.44
8.1.30.0030.00617.56
8.1.20.0000.00817.66
8.1.10.0000.00717.58
8.1.00.0080.00317.57
8.0.300.0030.00520.08
8.0.290.0040.00416.63
8.0.280.0040.00418.46
8.0.270.0030.00517.26
8.0.260.0000.00618.40
8.0.250.0000.00717.01
8.0.240.0000.00716.88
8.0.230.0000.00716.90
8.0.220.0040.00416.80
8.0.210.0070.00016.91
8.0.200.0030.00316.93
8.0.190.0030.00416.98
8.0.180.0050.00216.90
8.0.170.0070.00016.95
8.0.160.0040.00416.93
8.0.150.0040.00416.86
8.0.140.0040.00416.77
8.0.130.0030.00313.29
8.0.120.0040.00416.82
8.0.110.0070.00016.86
8.0.100.0040.00416.86
8.0.90.0040.00416.90
8.0.80.0040.01216.84
8.0.70.0040.00416.69
8.0.60.0090.00016.82
8.0.50.0050.00216.80
8.0.30.0130.01017.07
8.0.20.0110.01017.40
8.0.10.0070.00017.07
8.0.00.0120.00916.76
7.4.330.0030.00315.02
7.4.320.0000.00716.62
7.4.300.0040.00416.61
7.4.290.0000.00716.42
7.4.280.0030.00316.56
7.4.270.0050.00316.55
7.4.260.0030.00316.59
7.4.250.0070.00016.63
7.4.240.0000.00716.51
7.4.230.0040.00416.41
7.4.220.0160.00316.48
7.4.210.0060.00916.55
7.4.200.0040.00416.63
7.4.190.0070.00016.75
7.4.160.0080.00816.62
7.4.150.0090.00917.40
7.4.140.0070.01217.86
7.4.130.0090.00816.58
7.4.120.0100.01216.45
7.4.110.0100.00716.57
7.4.100.0150.00416.66
7.4.90.0140.01016.53
7.4.80.0110.01419.39
7.4.70.0100.00716.49
7.4.60.0110.00816.43
7.4.50.0060.00316.36
7.4.40.0110.00722.77
7.4.30.0100.00616.49
7.4.10.0070.01115.11
7.4.00.0100.00614.99
7.3.330.0030.00313.22
7.3.320.0030.00313.23
7.3.310.0000.00716.25
7.3.300.0000.00716.25
7.3.290.0110.00416.35
7.3.280.0090.00816.34
7.3.270.0030.01417.40
7.3.260.0120.00616.84
7.3.250.0110.01116.53
7.3.240.0060.01216.32
7.3.230.0090.00916.39
7.3.210.0160.00016.66
7.3.200.0090.01019.39
7.3.190.0060.01316.61
7.3.180.0070.01016.61
7.3.170.0030.01716.36
7.3.160.0090.01416.55
7.3.130.0060.01215.11
7.3.120.0090.00314.85
7.3.110.0070.01315.11
7.3.100.0060.01215.11
7.3.90.0100.00315.11
7.3.80.0070.01115.11
7.3.70.0100.00315.11
7.3.60.0040.01115.11
7.3.50.0090.00015.11
7.3.40.0070.00715.11
7.3.30.0080.00815.11
7.3.20.0100.00616.60
7.3.10.0080.00816.34
7.3.00.0030.00716.47
7.2.330.0160.00016.57
7.2.320.0060.01316.44
7.2.310.0200.00316.79
7.2.300.0180.00416.84
7.2.290.0070.01016.66
7.2.260.0030.01415.34
7.2.250.0070.00715.11
7.2.240.0080.00515.11
7.2.230.0100.01015.36
7.2.220.0060.00915.25
7.2.210.0080.00415.11
7.2.200.0060.01015.11
7.2.190.0030.01315.11
7.2.180.0030.01015.20
7.2.170.0000.01715.11
7.2.160.0070.01115.11
7.2.150.0080.00617.13
7.2.140.0060.00617.11
7.2.130.0090.00917.01
7.2.120.0060.00616.81
7.2.110.0070.00716.71
7.2.100.0000.01716.68
7.2.90.0050.00517.00
7.2.80.0040.01116.92
7.2.70.0120.00016.94
7.2.60.0050.00816.71
7.2.50.0040.01217.05
7.2.40.0070.00717.16
7.2.30.0000.01317.09
7.2.20.0060.00916.97
7.2.10.0070.00716.69
7.2.00.0030.01017.07
7.1.330.0030.01015.87
7.1.320.0030.01315.74
7.1.310.0060.00715.99
7.1.300.0030.01415.44
7.1.290.0080.00815.78
7.1.280.0090.00615.75
7.1.270.0030.01015.77
7.1.260.0140.00015.68
7.1.250.0000.01115.67
7.1.240.0000.01115.94
7.1.230.0000.00915.88
7.1.220.0070.00715.89
7.1.210.0040.01115.89
7.1.200.0020.00915.76
7.1.190.0070.01015.61
7.1.180.0030.00615.72
7.1.170.0070.00615.73
7.1.160.0040.00415.68
7.1.150.0000.00815.62
7.1.140.0040.01115.93
7.1.130.0100.00315.86
7.1.120.0000.01315.66
7.1.110.0070.00715.95
7.1.100.0030.00615.82
7.1.90.0030.00915.85
7.1.80.0040.00715.97
7.1.70.0040.00816.57
7.1.60.0020.01317.55
7.1.50.0080.00716.43
7.1.40.0040.01115.68
7.1.30.0110.00415.79
7.1.20.0040.00715.88
7.1.10.0040.00715.59
7.1.00.0000.04319.07
7.0.330.0040.00715.11
7.0.320.0040.00415.18
7.0.310.0030.00515.45
7.0.300.0040.00715.50
7.0.290.0060.00315.16
7.0.280.0050.00515.42
7.0.270.0040.00815.11
7.0.260.0100.00315.48
7.0.250.0030.00715.22
7.0.240.0080.00515.64
7.0.230.0000.01415.56
7.0.220.0080.00415.48
7.0.210.0030.00515.28
7.0.200.0070.00316.21
7.0.190.0070.00715.53
7.0.180.0060.00315.44
7.0.170.0060.00915.48
7.0.160.0080.00015.39
7.0.150.0040.00715.51
7.0.140.0020.04318.87
7.0.130.0070.00715.29
7.0.120.0130.00015.54
7.0.110.0040.00815.36
7.0.100.0070.00715.29
7.0.90.0080.00815.46
7.0.80.0070.00715.60
7.0.70.0040.00915.49
7.0.60.0110.03517.79
7.0.50.0090.04016.85
7.0.40.0020.03117.64
7.0.30.0190.03117.72
7.0.20.0150.03417.63
7.0.10.0050.02417.60
7.0.00.0050.04717.66
5.6.400.0030.00915.11
5.6.390.0040.00815.11
5.6.380.0000.01115.11
5.6.370.0040.01115.11
5.6.360.0060.00315.11
5.6.350.0000.01015.11
5.6.340.0030.00715.11
5.6.330.0070.00715.11
5.6.320.0100.00315.11
5.6.310.0060.00815.11
5.6.300.0060.00315.11
5.6.290.0000.01215.11
5.6.280.0090.03617.99
5.6.270.0040.00415.11
5.6.260.0060.00315.11
5.6.250.0040.01515.11
5.6.240.0090.00615.11
5.6.230.0030.00915.11
5.6.220.0000.01215.11
5.6.210.0070.03317.88
5.6.200.0050.04716.65
5.6.190.0070.02617.78
5.6.180.0160.02317.75
5.6.170.0120.02617.82
5.6.160.0020.03317.81
5.6.150.0040.02916.69
5.6.140.0050.02716.63
5.6.130.0050.02816.66
5.6.120.0030.04318.05
5.6.110.0070.04318.06
5.6.100.0030.04718.13
5.6.90.0080.02318.14
5.6.80.0050.03417.74
5.6.70.2180.02617.70
5.6.60.0030.00615.11
5.6.50.0030.00915.11
5.6.40.0030.00615.11
5.6.30.0100.00315.11
5.6.20.0100.00615.11
5.6.10.0030.00715.11
5.6.00.0030.01015.11
5.5.380.0070.00315.11
5.5.370.0000.00915.11
5.5.360.0070.00715.11
5.5.350.0050.04717.82
5.5.340.0030.03516.52
5.5.330.0050.04517.69
5.5.320.0150.02217.74
5.5.310.0180.04017.68
5.5.300.0080.02516.52
5.5.290.0030.04416.56
5.5.280.0030.02517.90
5.5.270.0100.02017.92
5.5.260.0070.04117.94
5.5.250.0050.04617.91
5.5.240.0170.04217.62
5.5.230.0000.01315.11
5.5.220.0090.00615.11
5.5.210.0070.00715.11
5.5.200.0040.00715.11
5.5.190.0030.01015.11
5.5.180.0030.01315.11
5.5.170.0080.00615.11
5.5.160.0060.00915.11
5.5.150.0060.00615.11
5.5.140.0100.00715.11
5.5.130.0030.01015.11
5.5.120.0060.01015.11
5.5.110.0060.00315.11
5.5.100.0040.01215.11
5.5.90.0070.00715.11
5.5.80.0070.01115.11
5.5.70.0070.01015.11
5.5.60.0040.00415.11
5.5.50.0070.00715.11
5.5.40.0040.01115.11
5.5.30.0040.01115.11
5.5.20.0090.00615.11
5.5.10.0090.00015.11
5.5.00.0080.00815.11
5.4.450.0160.03017.32
5.4.440.0180.03117.32
5.4.430.0190.03717.32
5.4.420.0180.03617.14
5.4.410.0210.03117.17
5.4.400.0120.02617.03
5.4.390.0130.02217.08
5.4.380.0200.03017.13
5.4.370.0180.02017.15
5.4.360.0120.03717.17
5.4.350.0180.02017.02
5.4.340.0160.02017.17
5.4.330.0000.01015.11
5.4.320.0120.02317.05
5.4.310.0150.02417.12
5.4.300.0230.03317.08
5.4.290.0120.03017.04
5.4.280.0150.02017.17
5.4.270.0120.02417.17
5.4.260.0180.01717.09
5.4.250.0140.03017.17
5.4.240.0130.03517.16
5.4.230.0150.03917.02
5.4.220.0130.02417.12
5.4.210.0130.02117.13
5.4.200.0120.03117.02
5.4.190.0150.02517.11
5.4.180.0190.03417.16
5.4.170.0170.02016.98
5.4.160.0240.03617.07
5.4.150.0200.03217.12
5.4.140.0170.03515.73
5.4.130.0100.03015.81
5.4.120.0130.02915.88
5.4.110.0150.02315.82
5.4.100.0150.02415.78
5.4.90.0170.02315.75
5.4.80.0130.02815.82
5.4.70.0200.02815.81
5.4.60.0170.03915.79
5.4.50.0120.02315.72
5.4.40.0150.03015.63
5.4.30.0250.02715.81
5.4.20.0150.01715.79
5.4.10.0150.04015.76
5.4.00.0170.02415.44
5.3.290.0130.02214.84
5.3.280.0130.03114.81
5.3.270.0150.04114.90
5.3.260.0210.02714.86
5.3.250.0220.03614.82
5.3.240.0180.02214.86
5.3.230.0120.02214.85
5.3.220.0150.04014.79
5.3.210.0130.03514.87
5.3.200.0230.03014.95
5.3.190.0150.01814.88
5.3.180.0200.02514.82
5.3.170.0130.02014.86
5.3.160.0180.03714.83
5.3.150.0150.02314.80
5.3.140.0210.03114.84
5.3.130.0150.02014.82
5.3.120.0150.02014.83
5.3.110.0150.04214.82
5.3.100.0120.04014.66
5.3.90.0130.02514.54
5.3.80.0160.01814.55
5.3.70.0160.03414.52
5.3.60.0150.03814.52
5.3.50.0130.03914.50
5.3.40.0130.02514.59
5.3.30.0170.01514.50
5.3.20.0170.02014.36
5.3.10.0130.03414.34
5.3.00.0150.02114.38
5.2.170.0200.03711.92
5.2.160.0130.04311.92
5.2.150.0100.03311.92
5.2.140.0130.03011.92
5.2.130.0170.05011.92
5.2.120.0270.02311.92
5.2.110.0170.03311.92
5.2.100.0230.02711.92
5.2.90.0230.05311.92
5.2.80.0170.04011.92
5.2.70.0200.03011.92
5.2.60.0230.05711.92
5.2.50.0270.03011.92
5.2.40.0170.02711.92
5.2.30.0170.02711.92
5.2.20.0130.03011.92
5.2.10.0230.05311.92
5.2.00.0200.04711.92
5.1.60.0100.03311.92
5.1.50.0370.01711.92
5.1.40.0100.02711.92
5.1.30.0130.04311.92
5.1.20.0200.03311.92
5.1.10.0200.03011.92
5.1.00.0300.03011.92
5.0.50.0030.03011.92
5.0.40.0070.02011.92
5.0.30.0100.03311.92
5.0.20.0100.01711.92
5.0.10.0070.02011.92
5.0.00.0070.03011.92
4.4.90.0070.03711.92
4.4.80.0070.02011.92
4.4.70.0070.01711.92
4.4.60.0030.02311.92
4.4.50.0070.01311.92
4.4.40.0100.05011.92
4.4.30.0070.01711.92
4.4.20.0100.01711.92
4.4.10.0070.01711.92
4.4.00.0070.02311.92
4.3.110.0070.01311.92
4.3.100.0030.01711.92
4.3.90.0030.01711.92
4.3.80.0030.02311.92
4.3.70.0030.01711.92
4.3.60.0030.01711.92
4.3.50.0100.01011.92
4.3.40.0070.02011.92
4.3.30.0030.01311.92
4.3.20.0000.01711.92
4.3.10.0030.01711.92
4.3.00.0000.01711.92

preferences:
50.04 ms | 401 KiB | 5 Q