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(); var_dump($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.0190.00017.00
8.3.50.0100.00921.22
8.3.40.0120.00918.74
8.3.30.0180.00418.73
8.3.20.0140.00320.30
8.3.10.0000.00823.66
8.3.00.0030.00519.80
8.2.180.0090.00916.75
8.2.170.0040.01122.96
8.2.160.0100.00320.47
8.2.150.0000.00824.18
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0030.00617.75
8.2.110.0070.00320.29
8.2.100.0060.00617.85
8.2.90.0050.00318.28
8.2.80.0040.00417.97
8.2.70.0080.00017.49
8.2.60.0040.00417.68
8.2.50.0040.00418.07
8.2.40.0080.00419.45
8.2.30.0030.00518.09
8.2.20.0080.00017.77
8.2.10.0080.00018.14
8.2.00.0000.00718.22
8.1.280.0090.00625.92
8.1.270.0060.00320.38
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.19
8.1.230.0040.00720.89
8.1.220.0040.00417.77
8.1.210.0090.00018.77
8.1.200.0000.01017.36
8.1.190.0040.00417.22
8.1.180.0050.00318.10
8.1.170.0060.00318.47
8.1.160.0040.00421.99
8.1.150.0080.00018.92
8.1.140.0040.00417.37
8.1.130.0040.00417.62
8.1.120.0070.00017.47
8.1.110.0040.00417.48
8.1.100.0050.00217.39
8.1.90.0000.00717.52
8.1.80.0000.00817.49
8.1.70.0000.00717.52
8.1.60.0040.00417.58
8.1.50.0000.00817.52
8.1.40.0000.00817.51
8.1.30.0050.00317.70
8.1.20.0000.00817.63
8.1.10.0000.00717.56
8.1.00.0040.00417.52
8.0.300.0040.00420.16
8.0.290.0000.00816.75
8.0.280.0070.00018.34
8.0.270.0000.00717.28
8.0.260.0060.00017.32
8.0.250.0000.00817.06
8.0.240.0030.00817.04
8.0.230.0000.00717.02
8.0.220.0030.00316.95
8.0.210.0030.00716.94
8.0.200.0000.00717.05
8.0.190.0000.00916.92
8.0.180.0030.00317.01
8.0.170.0030.00616.85
8.0.160.0040.00416.88
8.0.150.0000.00916.99
8.0.140.0120.00016.99
8.0.130.0000.00713.45
8.0.120.0030.00616.84
8.0.110.0000.00716.93
8.0.100.0000.00816.88
8.0.90.0080.00016.77
8.0.80.0070.00716.90
8.0.70.0040.00416.92
8.0.60.0000.00716.79
8.0.50.0040.00417.00
8.0.30.0090.00817.16
8.0.20.0150.00717.43
8.0.10.0070.00017.08
8.0.00.0150.00516.75
7.4.330.0020.00215.08
7.4.320.0000.00616.63
7.4.300.0030.00316.54
7.4.290.0070.00016.60
7.4.280.0000.00716.53
7.4.270.0040.00416.67
7.4.260.0000.00816.52
7.4.250.0020.00516.61
7.4.240.0010.00616.48
7.4.230.0070.00016.52
7.4.220.0120.00916.61
7.4.210.0040.01116.52
7.4.200.0040.00416.57
7.4.160.0120.00416.57
7.4.150.0090.01217.40
7.4.140.0080.01117.86
7.4.130.0100.01216.52
7.4.120.0120.00516.58
7.4.110.0120.00916.32
7.4.100.0110.01116.66
7.4.90.0090.00916.57
7.4.80.0150.00619.39
7.4.70.0030.01416.57
7.4.60.0110.00516.54
7.4.50.0080.00016.64
7.4.40.0060.00916.61
7.4.30.0000.01716.45
7.4.00.0150.00014.88
7.3.330.0030.00313.44
7.3.320.0000.00613.50
7.3.310.0000.00716.44
7.3.300.0030.00316.41
7.3.290.0080.00016.45
7.3.280.0080.00916.44
7.3.270.0120.00617.40
7.3.260.0150.00316.43
7.3.250.0090.00816.48
7.3.240.0030.01416.54
7.3.230.0130.01016.50
7.3.210.0040.01216.31
7.3.200.0040.01716.62
7.3.190.0100.00716.59
7.3.180.0060.01616.50
7.3.170.0000.01716.39
7.3.160.0130.00816.48
7.2.330.0060.01016.83
7.2.320.0120.00616.52
7.2.310.0120.00616.80
7.2.300.0000.01716.61
7.2.290.0090.00916.85
7.2.60.0110.00416.96
7.2.00.0030.00919.61
7.1.200.0040.00816.01
7.1.100.0070.00417.93
7.1.70.0000.00817.13
7.1.60.0070.01620.03
7.1.50.0070.01017.04
7.1.00.0070.07322.41
7.0.200.0070.00016.94
7.0.60.0070.08320.00
7.0.50.0030.07017.88
7.0.40.0100.05320.06
7.0.30.0370.08020.12
7.0.20.0200.04320.06
7.0.10.0330.06720.25
7.0.00.0100.08720.27
5.6.280.0000.05721.10
5.6.210.0130.07320.70
5.6.200.0030.04018.16
5.6.190.0100.05320.77
5.6.180.0130.07720.42
5.6.170.0270.07720.59
5.6.160.0130.07720.40
5.6.150.0030.08318.14
5.6.140.0000.06318.15
5.6.130.0130.04718.15
5.6.120.0100.08021.01
5.6.110.0030.08720.97
5.6.100.0170.07021.00
5.6.90.0230.06721.10
5.6.80.0070.08020.45
5.6.70.4530.03320.51
5.5.350.0000.04320.45
5.5.340.0070.05317.98
5.5.330.0070.04720.27
5.5.320.0070.04320.35
5.5.310.0270.06320.30
5.5.300.0100.04717.97
5.5.290.0070.04018.08
5.5.280.0070.03720.99
5.5.270.0070.05020.89
5.5.260.0100.07720.66
5.5.250.0100.03720.50
5.5.240.0030.08020.18
5.4.450.0530.08319.48
5.4.440.0730.05319.47
5.4.430.0700.07319.35
5.4.420.0800.07019.60
5.4.410.0770.04719.21
5.4.400.0530.05018.98
5.4.390.0570.04718.89
5.4.380.0430.05719.33
5.4.370.0530.04718.87
5.4.360.0500.06318.87
5.4.350.0800.07319.15
5.4.340.0670.05019.23
5.4.320.0670.05318.98
5.4.310.0600.05719.32
5.4.300.0530.05719.28
5.4.290.0700.05318.86
5.4.280.0700.04319.05
5.4.270.0700.05019.25
5.4.260.0600.05018.84
5.4.250.0670.05018.88
5.4.240.0600.06019.28
5.4.230.0630.04719.06
5.4.220.0600.07719.05
5.4.210.0570.05719.27
5.4.200.0700.04319.12
5.4.190.0670.04718.86
5.4.180.0630.05019.13
5.4.170.0500.05019.29
5.4.160.0630.05319.21
5.4.150.0600.05319.20
5.4.140.0630.05016.56
5.4.130.0700.04016.39
5.4.120.0630.05016.33
5.4.110.0570.05316.52
5.4.100.0630.04716.51
5.4.90.0600.05016.52
5.4.80.0670.05016.61
5.4.70.0000.04716.57
5.4.60.0000.07716.53
5.4.50.0130.06316.41
5.4.40.0100.03716.43
5.4.30.0230.07316.32
5.4.20.0270.06716.33
5.4.10.0300.06716.21

preferences:
54.82 ms | 401 KiB | 5 Q