3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a implements \Iterator, \Countable { private $a; private $b; private $c; private $keys = [ 'a', 'b', 'c' ]; private $pointer; public function __construc($a = null, $b = null, $c = null) { $this->a = $a; $this->b = $b; $this->c = $c; } public function count() { $pointer = 0; foreach ($this as $element) { if ($element) { $pointer++; } } return $pointer; } public function current() { $key = $this->key(); return $this->{$key}; } public function key() { $this->keys[$this->pointer]; } public function next() { $this->pointer++; } public function valid() { return $this->pointer < count($this->keys); } public function rewind() { $this->pointer = 0; } } $me = new a('a'); var_dump($me->count()); foreach ($me as $key => $el) { var_dump($key, $el); }

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.0070.01316.75
8.3.50.0100.00921.14
8.3.40.0040.01118.67
8.3.30.0070.00718.79
8.3.20.0040.00422.10
8.3.10.0030.00523.70
8.3.00.0080.00019.68
8.2.180.0100.01016.63
8.2.170.0040.01122.96
8.2.160.0120.00320.35
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0050.00317.88
8.2.110.0090.00020.14
8.2.100.0060.00617.88
8.2.90.0040.00419.21
8.2.80.0050.00517.97
8.2.70.0080.00017.63
8.2.60.0030.00518.05
8.2.50.0050.00318.07
8.2.40.0070.00321.13
8.2.30.0030.00618.21
8.2.20.0040.00417.68
8.2.10.0040.00418.06
8.2.00.0000.00718.19
8.1.280.0070.00725.92
8.1.270.0090.00020.37
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0040.00423.95
8.1.230.0080.00417.42
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0060.00317.35
8.1.190.0080.00017.22
8.1.180.0050.00318.10
8.1.170.0090.00018.66
8.1.160.0040.00422.04
8.1.150.0040.00418.88
8.1.140.0050.00317.42
8.1.130.0050.00217.70
8.1.120.0050.00217.47
8.1.110.0040.00417.36
8.1.100.0040.00417.56
8.1.90.0040.00417.45
8.1.80.0080.00017.38
8.1.70.0040.00417.51
8.1.60.0050.00317.61
8.1.50.0000.00817.59
8.1.40.0050.00317.49
8.1.30.0000.00817.57
8.1.20.0000.00817.69
8.1.10.0000.00817.49
8.1.00.0040.00417.58
8.0.300.0000.00918.77
8.0.290.0040.00416.75
8.0.280.0050.00218.47
8.0.270.0000.00717.25
8.0.260.0030.00517.35
8.0.250.0000.00717.07
8.0.240.0110.00017.09
8.0.230.0000.00717.04
8.0.220.0000.00716.86
8.0.210.0030.00616.97
8.0.200.0030.00516.94
8.0.190.0000.00817.01
8.0.180.0030.00317.02
8.0.170.0030.00517.00
8.0.160.0030.00416.95
8.0.150.0070.00016.86
8.0.140.0070.00416.80
8.0.130.0070.00013.39
8.0.120.0060.00316.86
8.0.110.0000.00716.98
8.0.100.0040.00416.83
8.0.90.0000.00716.88
8.0.80.0070.00716.87
8.0.70.0030.00517.07
8.0.60.0000.00716.93
8.0.50.0040.00416.94
8.0.30.0110.00617.08
8.0.20.0110.01117.43
8.0.10.0040.00417.11
8.0.00.0090.01216.83
7.4.330.0030.00315.08
7.4.320.0000.00616.66
7.4.300.0000.00716.63
7.4.290.0000.00716.48
7.4.280.0000.00816.62
7.4.270.0040.00416.63
7.4.260.0040.00716.62
7.4.250.0070.00016.57
7.4.240.0040.00316.54
7.4.230.0000.00716.63
7.4.220.0110.01116.62
7.4.210.0090.00516.65
7.4.200.0000.00716.43
7.4.160.0110.00516.80
7.4.150.0090.00917.40
7.4.140.0110.00817.86
7.4.130.0110.00816.54
7.4.120.0110.00716.48
7.4.110.0060.01316.68
7.4.100.0120.00916.55
7.4.90.0100.00716.59
7.4.80.0160.00319.39
7.4.70.0120.00516.59
7.4.60.0120.00416.51
7.4.50.0030.00616.60
7.4.40.0030.01316.70
7.4.30.0090.00916.57
7.4.00.0090.00915.03
7.3.330.0060.00013.46
7.3.320.0000.00513.33
7.3.310.0040.00416.34
7.3.300.0030.00316.32
7.3.290.0000.00816.42
7.3.280.0080.00816.41
7.3.270.0130.00917.40
7.3.260.0070.01016.42
7.3.250.0110.00916.50
7.3.240.0090.00916.57
7.3.230.0110.01416.62
7.3.210.0060.01116.43
7.3.200.0040.01216.36
7.3.190.0120.00616.47
7.3.180.0090.01516.26
7.3.170.0060.01816.43
7.3.160.0070.00616.47
7.3.120.0050.01114.78
7.3.110.0070.01114.87
7.3.100.0100.00115.00
7.3.90.0020.01415.02
7.3.80.0060.00514.92
7.3.70.0030.00914.96
7.3.60.0030.00914.85
7.3.50.0060.00914.80
7.3.40.0030.01014.93
7.3.30.0070.00514.79
7.3.20.0020.01016.84
7.3.10.0060.00816.81
7.3.00.0110.00416.74
7.2.330.0070.01016.81
7.2.320.0030.01516.77
7.2.310.0070.01416.74
7.2.300.0060.01116.77
7.2.290.0110.00616.45
7.2.250.0080.01115.14
7.2.240.0050.01515.14
7.2.230.0100.00815.07
7.2.220.0080.00315.27
7.2.210.0080.00515.16
7.2.200.0080.00615.16
7.2.190.0050.01114.90
7.2.180.0020.01315.11
7.2.170.0050.01015.10
7.2.60.0030.01316.83
7.2.00.0080.00419.14
7.1.330.0050.01115.79
7.1.320.0050.00915.84
7.1.310.0090.00715.90
7.1.300.0020.01115.68
7.1.290.0060.00815.97
7.1.280.0050.00615.73
7.1.270.0000.01315.78
7.1.260.0060.00415.86
7.1.200.0060.00615.46
7.1.70.0000.00817.28
7.1.60.0040.01917.38
7.1.50.0070.01416.70
7.1.00.0030.07722.30
7.0.200.0070.01016.86
7.0.60.0100.05020.09
7.0.50.0030.08317.90
7.0.40.0070.05320.27
7.0.30.0370.07020.23
7.0.20.0400.07020.30
7.0.10.0030.06020.10
7.0.00.0130.08320.06
5.6.280.0070.06320.93
5.6.210.0070.05020.76
5.6.200.0070.04018.13
5.6.190.0030.04320.79
5.6.180.3370.04020.61
5.6.170.0130.04320.71
5.6.160.0000.09020.46
5.6.150.0070.07018.29
5.6.140.0130.07718.17
5.6.130.0030.04318.14
5.6.120.0070.08020.97
5.6.110.0070.08321.04
5.6.100.0070.08021.05
5.6.90.0130.07720.97
5.6.80.0030.08020.54
5.6.70.4170.04320.41
5.5.350.0030.08020.39
5.5.340.0070.08017.95
5.5.330.0070.04720.43
5.5.320.0300.07320.26
5.5.310.0330.04020.37
5.5.300.0070.03717.94
5.5.290.0070.04018.00
5.5.280.0100.05020.79
5.5.270.0130.07020.74
5.5.260.0130.07020.66
5.5.250.0130.08320.70
5.5.240.0300.07020.20
5.4.450.0630.05319.48
5.4.440.0730.05719.19
5.4.430.0630.05319.70
5.4.420.0530.05319.58
5.4.410.0630.05319.32
5.4.400.0670.04319.29
5.4.390.0570.07019.38
5.4.380.0630.05019.15
5.4.370.0570.05318.89
5.4.360.0430.06319.01
5.4.350.0570.04719.38
5.4.340.0530.06019.05
5.4.320.0700.04319.01
5.4.310.0600.05019.28
5.4.300.0670.05019.25
5.4.290.0600.05019.14
5.4.280.0730.07319.28
5.4.270.0600.05019.10
5.4.260.0600.05019.14
5.4.250.0570.06319.14
5.4.240.0570.05319.14
5.4.230.0670.05319.30
5.4.220.0600.06719.27
5.4.210.0630.05018.86
5.4.200.0570.04719.14
5.4.190.0600.06018.83
5.4.180.0500.04718.97
5.4.170.0500.05319.32
5.4.160.0530.04318.85
5.4.150.0600.04319.27
5.4.140.0400.06016.74
5.4.130.0470.05016.43
5.4.120.0630.04316.53
5.4.110.0500.05316.62
5.4.100.0500.05016.61
5.4.90.0530.04716.42
5.4.80.0530.04716.50
5.4.70.0030.07316.45
5.4.60.0400.06016.51
5.4.50.0070.06716.49
5.4.40.0330.06316.51
5.4.30.0000.03716.43
5.4.20.0200.03316.37

preferences:
52.85 ms | 401 KiB | 5 Q