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() { if (count($this->keys) < $this->pointer) { true; } return false; } 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.01116.63
8.3.50.0100.01221.22
8.3.40.0040.01418.86
8.3.30.0090.00618.85
8.3.20.0130.00620.16
8.3.10.0040.00423.65
8.3.00.0050.00319.80
8.2.180.0040.01116.63
8.2.170.0120.00322.96
8.2.160.0110.01420.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0080.00017.74
8.2.110.0030.00620.14
8.2.100.0030.00917.63
8.2.90.0030.00619.05
8.2.80.0060.00617.97
8.2.70.0000.00817.50
8.2.60.0080.00018.03
8.2.50.0030.00618.07
8.2.40.0040.00519.18
8.2.30.0080.00018.01
8.2.20.0050.00317.63
8.2.10.0000.00818.25
8.2.00.0020.00518.13
8.1.280.0070.01125.92
8.1.270.0000.00820.33
8.1.260.0080.00026.35
8.1.250.0000.00728.09
8.1.240.0030.00623.96
8.1.230.0060.00617.42
8.1.220.0000.00817.74
8.1.210.0060.00318.77
8.1.200.0040.00417.35
8.1.190.0050.00317.00
8.1.180.0040.00418.10
8.1.170.0060.00318.52
8.1.160.0040.00422.04
8.1.150.0000.00718.90
8.1.140.0040.00417.48
8.1.130.0030.00317.60
8.1.120.0000.00717.46
8.1.110.0040.00417.49
8.1.100.0040.00417.52
8.1.90.0050.00217.44
8.1.80.0000.00717.53
8.1.70.0070.00017.52
8.1.60.0040.00417.66
8.1.50.0080.00017.58
8.1.40.0080.00017.43
8.1.30.0040.00417.62
8.1.20.0040.00417.64
8.1.10.0020.00517.58
8.1.00.0000.00817.39
8.0.300.0040.00418.77
8.0.290.0060.00316.63
8.0.280.0030.00318.43
8.0.270.0030.00317.36
8.0.260.0040.00417.33
8.0.250.0040.00416.92
8.0.240.0030.00817.05
8.0.230.0030.00316.96
8.0.220.0000.00716.82
8.0.210.0030.00616.81
8.0.200.0020.00516.98
8.0.190.0080.00017.00
8.0.180.0000.00716.91
8.0.170.0040.00416.96
8.0.160.0050.00316.89
8.0.150.0030.00616.86
8.0.140.0090.00316.88
8.0.130.0060.00013.35
8.0.120.0030.00516.89
8.0.110.0070.00016.93
8.0.100.0000.00816.74
8.0.90.0000.00816.93
8.0.80.0080.00816.95
8.0.70.0000.00716.96
8.0.60.0040.00416.92
8.0.50.0000.00816.79
8.0.30.0120.00617.19
8.0.20.0080.01217.40
8.0.10.0040.00417.04
8.0.00.0130.00516.79
7.4.330.0050.00015.08
7.4.320.0030.00316.66
7.4.300.0000.00716.60
7.4.290.0030.00616.42
7.4.280.0040.00416.46
7.4.270.0000.00716.58
7.4.260.0030.00516.66
7.4.250.0040.00416.41
7.4.240.0030.00416.50
7.4.230.0070.00016.36
7.4.220.0140.00416.60
7.4.210.0080.00916.58
7.4.200.0070.00016.55
7.4.160.0060.00916.57
7.4.150.0080.00817.40
7.4.140.0150.00617.86
7.4.130.0090.00816.53
7.4.120.0080.00916.41
7.4.110.0030.02116.61
7.4.100.0140.00516.55
7.4.90.0070.01016.62
7.4.80.0160.00619.39
7.4.70.0060.01616.51
7.4.60.0060.01016.59
7.4.50.0030.00616.40
7.4.40.0060.01216.73
7.4.30.0160.00316.66
7.4.00.0040.01214.90
7.3.330.0040.00213.30
7.3.320.0000.00513.32
7.3.310.0050.00216.33
7.3.300.0000.00716.37
7.3.290.0070.00016.33
7.3.280.0070.01116.26
7.3.270.0160.00617.40
7.3.260.0070.01016.54
7.3.250.0070.01016.44
7.3.240.0030.01316.28
7.3.230.0060.01616.52
7.3.210.0160.00016.73
7.3.200.0080.00916.55
7.3.190.0100.00616.71
7.3.180.0100.01016.57
7.3.170.0070.01116.57
7.3.160.0170.00616.42
7.2.330.0110.00616.79
7.2.320.0030.01616.54
7.2.310.0070.01016.83
7.2.300.0110.00716.64
7.2.290.0080.00816.83
7.2.00.0030.00719.40
7.1.100.0000.01018.07
7.1.70.0000.01417.18
7.1.60.0090.01620.03
7.1.50.0090.01316.80
7.1.00.0000.07722.52
7.0.200.0080.00416.88
7.0.60.0000.05720.02
7.0.50.0000.04317.87
7.0.40.0070.04020.24
7.0.30.2470.04320.26
7.0.20.0300.03720.22
7.0.10.0400.07020.15
7.0.00.0070.08720.33
5.6.280.0070.04721.00
5.6.210.0070.08320.62
5.6.200.0100.03318.15
5.6.190.0070.08720.62
5.6.180.0030.07720.41
5.6.170.0300.05320.57
5.6.160.0030.04720.54
5.6.150.0030.04718.29
5.6.140.0070.08018.18
5.6.130.0030.08718.27
5.6.120.0130.08320.99
5.6.110.0070.04320.99
5.6.100.0070.08721.10
5.6.90.0100.08721.14
5.6.80.0130.06720.52
5.6.70.0330.06320.49
5.5.350.0070.05020.45
5.5.340.0100.07017.95
5.5.330.0100.08320.27
5.5.320.0030.05720.25
5.5.310.0300.07720.24
5.5.300.0070.04017.98
5.5.290.0130.06317.95
5.5.280.0200.06020.91
5.5.270.0070.07020.77
5.5.260.0200.05020.97
5.5.250.0070.03720.72
5.5.240.0070.07320.16
5.4.450.0500.06319.63
5.4.440.0530.05319.58
5.4.430.0630.04319.70
5.4.420.0470.06019.61
5.4.410.0470.05319.32
5.4.400.0470.05319.14
5.4.390.0430.05719.25
5.4.380.0630.06319.29
5.4.370.0630.06319.13
5.4.360.0570.05319.06
5.4.350.0670.07019.29
5.4.340.0730.06319.29
5.4.320.0770.04718.84
5.4.310.0670.06019.26
5.4.300.0630.04719.07
5.4.290.0530.05719.01
5.4.280.0530.05719.26
5.4.270.0570.05719.25
5.4.260.0730.05719.13
5.4.250.0630.05719.28
5.4.240.0530.05719.13
5.4.230.0630.05019.10
5.4.220.0570.05319.23
5.4.210.0600.05319.22
5.4.200.0670.05019.37
5.4.190.0670.06719.37
5.4.180.0800.04019.00
5.4.170.0600.05319.22
5.4.160.0570.04719.35
5.4.150.0670.05719.04
5.4.140.0630.04716.29
5.4.130.0570.05016.56
5.4.120.0600.05016.35
5.4.110.0570.06716.52
5.4.100.0600.04716.60
5.4.90.0630.04716.72
5.4.80.0500.04316.45
5.4.70.0000.04016.38
5.4.60.0100.04716.54
5.4.50.0000.04716.16
5.4.40.0100.06316.52
5.4.30.0270.04716.17
5.4.20.0270.04016.43
5.4.10.0370.05716.25

preferences:
44.79 ms | 401 KiB | 5 Q