3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a implements \ArrayAccess, \Iterator, \Countable { private $a; private $b; private $c; private $keys = [ 'a', 'b', 'c' ]; private $pointer; public function __construct($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() { return $this->keys[$this->pointer]; } public function next() { $this->pointer++; } public function valid() { return $this->pointer < count($this->keys) && $this->{$this->keys[$this->pointer]} !== null; } public function rewind() { $this->pointer = 0; } } $me = new a(1,2,3); var_dump($me->count()); foreach ($me as $key => $el) { var_dump($key, $el); } var_dump($me);

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.0120.00616.50
8.3.50.0110.00716.41
8.3.40.0100.01018.53
8.3.30.0070.00718.77
8.3.20.0050.00320.29
8.3.10.0040.00421.90
8.3.00.0080.00019.55
8.2.180.0090.00616.63
8.2.170.0120.00322.96
8.2.160.0070.00720.33
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00417.50
8.2.110.0030.00621.18
8.2.100.0060.00617.78
8.2.90.0040.00417.91
8.2.80.0000.00719.21
8.2.70.0030.00617.91
8.2.60.0000.00817.68
8.2.50.0040.00418.10
8.2.40.0030.00620.59
8.2.30.0030.00618.04
8.2.20.0000.00817.63
8.2.10.0000.00718.15
8.2.00.0040.00318.02
8.1.280.0170.00325.92
8.1.270.0050.00320.25
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00522.46
8.1.230.0040.00720.95
8.1.220.0030.00517.74
8.1.210.0050.00318.77
8.1.200.0040.00417.23
8.1.190.0040.00417.13
8.1.180.0000.00818.10
8.1.170.0070.00318.65
8.1.160.0080.00022.21
8.1.150.0030.00518.85
8.1.140.0000.00817.40
8.1.130.0030.00317.77
8.1.120.0000.00817.48
8.1.110.0080.00017.44
8.1.100.0050.00217.42
8.1.90.0040.00417.31
8.1.80.0000.00717.33
8.1.70.0030.00317.46
8.1.60.0040.00417.58
8.1.50.0040.00417.50
8.1.40.0040.00417.43
8.1.30.0090.00017.62
8.1.20.0000.00817.51
8.1.10.0040.00417.32
8.1.00.0000.00917.31
8.0.300.0000.00720.03
8.0.290.0060.00316.75
8.0.280.0000.00718.41
8.0.270.0070.00017.13
8.0.260.0070.00017.14
8.0.250.0000.00816.89
8.0.240.0060.00316.95
8.0.230.0000.00716.88
8.0.220.0070.00016.92
8.0.210.0000.00916.80
8.0.200.0060.00017.03
8.0.190.0070.00216.91
8.0.180.0000.00816.84
8.0.170.0080.00016.93
8.0.160.0030.00516.93
8.0.150.0050.00216.82
8.0.140.0030.00716.87
8.0.130.0030.00313.30
8.0.120.0030.00516.81
8.0.110.0070.00016.83
8.0.100.0040.00416.88
8.0.90.0070.00016.95
8.0.80.0040.01116.90
8.0.70.0040.00416.96
8.0.60.0040.00416.88
8.0.50.0000.00716.80
8.0.30.0120.00616.96
8.0.20.0130.00417.40
8.0.10.0000.00716.92
8.0.00.0120.00916.73
7.4.330.0000.00515.08
7.4.320.0040.00416.48
7.4.300.0070.00016.46
7.4.290.0000.00816.50
7.4.280.0000.00716.57
7.4.270.0030.00316.48
7.4.260.0100.00016.57
7.4.250.0030.00616.42
7.4.240.0070.00016.45
7.4.230.0030.00316.57
7.4.220.0130.01216.45
7.4.210.0050.01216.54
7.4.200.0030.00316.52
7.4.160.0130.00316.59
7.4.150.0130.00417.40
7.4.140.0110.01317.86
7.4.130.0030.01716.52
7.4.120.0140.00616.43
7.4.110.0140.00316.48
7.4.100.0180.00616.31
7.4.90.0120.00916.45
7.4.80.0150.00319.39
7.4.70.0140.00716.44
7.4.60.0120.00316.44
7.4.50.0000.00816.60
7.4.40.0060.00916.38
7.4.30.0120.00616.57
7.4.00.0080.00814.92
7.3.330.0050.00013.26
7.3.320.0000.00513.25
7.3.310.0000.00716.21
7.3.300.0070.00016.31
7.3.290.0070.00016.14
7.3.280.0110.00716.26
7.3.270.0130.00317.40
7.3.260.0090.01216.48
7.3.250.0070.01016.22
7.3.240.0100.00716.51
7.3.230.0100.00916.39
7.3.210.0090.01216.37
7.3.200.0130.00316.55
7.3.190.0100.01016.27
7.3.180.0060.01316.34
7.3.170.0070.01016.41
7.3.160.0110.00816.32
7.3.120.0070.01014.38
7.3.110.0100.00714.60
7.3.100.0110.00314.82
7.3.90.0040.01114.70
7.3.80.0060.00614.65
7.3.70.0080.00814.91
7.3.60.0060.00614.79
7.3.50.0040.01514.70
7.3.40.0030.01314.68
7.3.30.0040.01114.78
7.3.20.0110.00016.65
7.3.10.0050.00816.57
7.3.00.0080.00516.63
7.2.330.0060.01116.31
7.2.320.0070.01016.73
7.2.310.0080.00816.52
7.2.300.0090.00916.41
7.2.290.0070.01416.70
7.2.250.0070.01014.81
7.2.240.0030.01514.90
7.2.230.0030.01414.79
7.2.220.0030.00714.55
7.2.210.0040.01414.83
7.2.200.0100.00715.14
7.2.190.0060.01014.71
7.2.180.0090.00614.79
7.2.170.0070.01014.88
7.2.130.0120.00316.99
7.2.120.0060.00316.84
7.2.110.0100.00016.68
7.2.100.0060.00316.80
7.2.90.0090.00616.99
7.2.80.0130.00016.59
7.2.70.0100.00016.86
7.2.60.0040.00916.78
7.2.50.0030.00716.58
7.2.40.0070.00716.65
7.2.30.0060.01016.93
7.2.20.0030.00716.75
7.2.10.0030.00916.89
7.2.00.0030.00918.02
7.1.330.0100.00715.44
7.1.320.0030.00615.60
7.1.310.0000.01115.66
7.1.300.0060.00315.64
7.1.290.0030.01315.66
7.1.280.0080.00515.56
7.1.270.0050.00515.45
7.1.260.0040.01115.71
7.1.250.0060.00315.50
7.1.200.0030.01015.75
7.1.100.0040.01117.77
7.1.70.0080.00016.54
7.1.60.0110.00720.03
7.1.50.0070.00316.96
7.1.00.0070.07322.36
7.0.200.0160.00416.56
7.0.60.0070.08719.86
7.0.50.0130.06317.98
7.0.40.0070.04020.40
7.0.30.0130.07320.06
7.0.20.0270.08720.16
7.0.10.0230.07020.19
7.0.00.0100.03720.09
5.6.280.0000.03321.09
5.6.210.0030.04020.70
5.6.200.0130.07718.19
5.6.190.0130.05320.46
5.6.180.0000.08720.77
5.6.170.0230.04720.39
5.6.160.0130.06320.46
5.6.150.0030.04018.18
5.6.140.0070.06718.26
5.6.130.0030.08318.18
5.6.120.0070.07320.91
5.6.110.0030.07321.00
5.6.100.0100.07721.12
5.6.90.0100.06321.11
5.6.80.0070.07320.41
5.6.70.3300.03020.37
5.5.350.0070.08020.44
5.5.340.0070.08017.94
5.5.330.0070.08720.43
5.5.320.0000.06020.35
5.5.310.0230.05320.25
5.5.300.0230.06318.08
5.5.290.0000.04718.09
5.5.280.0070.04720.90
5.5.270.0070.08320.73
5.5.260.0030.08320.68
5.5.250.0130.07020.78
5.5.240.0070.08320.08
5.4.450.0100.06319.69
5.4.440.0270.05319.61
5.4.430.0230.05019.61
5.4.420.0170.06019.62
5.4.410.0100.06019.26
5.4.400.0200.05019.29
5.4.390.0370.03719.13
5.4.380.0170.05718.84
5.4.370.0200.05019.22
5.4.360.0230.05019.01
5.4.350.0170.05319.38
5.4.340.0170.05319.13
5.4.320.0170.05319.26
5.4.310.0100.05719.15
5.4.300.0170.05319.28
5.4.290.0300.04318.97
5.4.280.0200.05318.87
5.4.270.0170.06019.12
5.4.260.0100.06019.08
5.4.250.0200.05018.97
5.4.240.0200.05319.14
5.4.230.0200.05019.14
5.4.220.0300.04319.22
5.4.210.0170.05318.83
5.4.200.0130.06019.12
5.4.190.0230.05019.32
5.4.180.0130.06018.96
5.4.170.0200.05319.28
5.4.160.0400.05318.85
5.4.150.0370.06019.20
5.4.140.0170.05316.45
5.4.130.0100.05316.50
5.4.120.0200.04716.53
5.4.110.0200.04716.52
5.4.100.0070.05716.60
5.4.90.0130.05016.61
5.4.80.0200.04316.45
5.4.70.0030.06016.52
5.4.60.0070.06316.54
5.4.50.0100.06716.45
5.4.40.0100.04716.51
5.4.30.0200.06716.16
5.4.20.0370.06316.48
5.4.10.0270.07016.25

preferences:
32.43 ms | 400 KiB | 5 Q