3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Odometer { public function __construct(array $values, $max_places = 0){ $this->values = array_values($values); $this->max_places = $max_places; reset($values); $this->register[0] = key($values); end($values); $this->limit = key($values); } public function iterate($force = false){ $rollback = $this->register; $this->register[0]++; for($i = 0; $i < count($this->register); $i++){ if($this->register[$i] > $this->limit){ $this->register[$i] = 0; if(isset($this->register[$i+1])){ $this->register[$i+1]++; } else { if($this->max_places && count($this->register)+1 > $this->max_places && !$force){ $this->register = $rollback; return; } $this->register[$i+1] = 0; } } } } public function setMeter(){ for($i = 0; $i < count($this->register); $i++){ $this->meter[$i] = $this->values[$this->register[$i]]; } } public function readMeter(){ $this->setMeter(); return '[' . implode('][', array_reverse($this->meter)) . ']' . "\n"; } } $o = new Odometer(range('a','c'), 2); echo $o->readMeter(); for($i = 0; $i < 20; $i++){ $o->iterate(false); echo $o->readMeter(); }

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.00916.88
8.3.50.0070.01016.42
8.3.40.0040.01118.83
8.3.30.0100.01319.02
8.3.20.0080.00020.61
8.3.10.0060.00321.63
8.3.00.0080.00021.73
8.2.180.0130.01016.50
8.2.170.0110.00422.96
8.2.160.0110.00722.13
8.2.150.0080.00024.18
8.2.140.0050.00524.66
8.2.130.0140.00319.89
8.2.120.0080.00026.35
8.2.110.0070.00322.08
8.2.100.0030.01119.77
8.2.90.0000.00818.03
8.2.80.0060.00319.11
8.2.70.0060.00317.63
8.2.60.0040.00417.63
8.2.50.0000.00817.63
8.2.40.0040.00420.34
8.2.30.0070.00019.27
8.2.20.0070.00018.13
8.2.10.0050.00318.17
8.2.00.0080.00017.84
8.1.280.0070.01125.92
8.1.270.0000.00922.08
8.1.260.0020.00528.09
8.1.250.0050.00228.09
8.1.240.0000.00923.92
8.1.230.0080.00322.73
8.1.220.0030.00517.78
8.1.210.0040.00418.80
8.1.200.0000.01017.38
8.1.190.0080.00017.38
8.1.180.0030.00618.10
8.1.170.0040.00418.63
8.1.160.0070.00322.19
8.1.150.0040.00422.05
8.1.140.0050.00219.55
8.1.130.0000.00917.68
8.1.120.0000.00717.55
8.1.110.0020.00517.50
8.1.100.0000.00717.38
8.1.90.0040.00417.43
8.1.80.0000.00717.37
8.1.70.0060.00317.50
8.1.60.0030.00617.60
8.1.50.0090.00017.57
8.1.40.0080.00017.57
8.1.30.0050.00317.70
8.1.20.0000.00717.57
8.1.10.0040.00417.62
8.1.00.0040.00417.50
8.0.300.0030.00620.09
8.0.290.0050.00316.88
8.0.280.0030.00318.46
8.0.270.0000.00817.14
8.0.260.0070.00017.14
8.0.250.0000.00816.96
8.0.240.0000.00716.83
8.0.230.0070.00016.99
8.0.220.0030.00316.93
8.0.210.0040.00416.95
8.0.200.0000.00617.01
8.0.190.0030.00817.00
8.0.180.0000.00816.88
8.0.170.0070.00016.89
8.0.160.0000.00716.94
8.0.150.0000.00716.76
8.0.140.0000.00716.93
8.0.130.0030.00513.38
8.0.120.0040.00416.91
8.0.110.0070.00016.78
8.0.100.0070.00016.93
8.0.90.0040.00416.76
8.0.80.0090.00616.89
8.0.70.0000.00716.86
8.0.60.0000.00716.84
8.0.50.0050.00216.96
8.0.30.0060.01416.96
8.0.20.0090.01017.40
8.0.10.0000.00816.86
8.0.00.0070.01116.87
7.4.330.0000.00515.55
7.4.320.0030.00316.61
7.4.300.0060.00016.56
7.4.290.0030.00316.49
7.4.280.0000.00816.45
7.4.270.0030.00316.44
7.4.260.0040.00416.39
7.4.250.0000.00716.57
7.4.240.0040.00416.57
7.4.230.0070.00016.61
7.4.220.0130.00716.54
7.4.210.0040.00916.51
7.4.200.0000.00716.52
7.4.160.0020.01416.54
7.4.150.0090.00917.40
7.4.140.0120.00517.86
7.4.130.0120.01116.46
7.4.120.0140.00716.57
7.4.110.0110.00816.55
7.4.100.0130.01016.64
7.4.90.0110.00716.41
7.4.80.0040.01519.39
7.4.70.0120.00916.66
7.4.60.0070.01016.43
7.4.50.0060.00616.23
7.4.40.0000.01616.63
7.4.30.0060.00916.66
7.4.00.0080.00914.77
7.3.330.0030.00313.18
7.3.320.0020.00213.19
7.3.310.0030.00316.32
7.3.300.0030.00316.29
7.3.290.0060.00916.36
7.3.280.0080.00916.36
7.3.270.0080.00817.40
7.3.260.0110.00916.43
7.3.250.0090.00916.57
7.3.240.0100.01216.53
7.3.230.0140.00316.41
7.3.210.0070.01016.30
7.3.200.0040.01216.36
7.3.190.0080.01116.62
7.3.180.0000.01516.56
7.3.170.0130.00916.63
7.3.160.0160.00616.27
7.3.120.0030.01314.70
7.3.110.0010.01314.81
7.3.100.0070.00814.96
7.3.90.0070.00814.95
7.3.80.0100.00514.88
7.3.70.0090.00714.79
7.3.60.0060.00614.79
7.3.50.0100.00514.83
7.3.40.0070.00614.79
7.3.30.0050.01214.87
7.3.20.0050.00616.61
7.3.10.0060.00816.56
7.3.00.0040.00916.85
7.2.330.0070.01316.63
7.2.320.0070.01016.84
7.2.310.0060.01116.91
7.2.300.0090.00916.53
7.2.290.0030.01316.48
7.2.250.0070.01114.96
7.2.240.0090.00815.05
7.2.230.0100.00715.11
7.2.220.0080.00915.21
7.2.210.0040.01115.19
7.2.200.0050.00814.93
7.2.190.0080.01015.15
7.2.180.0060.01014.97
7.2.170.0070.00715.15
7.2.160.0120.00314.79
7.2.150.0070.00717.07
7.2.140.0100.00716.88
7.2.130.0060.01216.93
7.2.120.0070.00716.91
7.2.110.0040.00717.16
7.2.100.0030.01117.00
7.2.90.0000.01517.07
7.2.80.0080.00417.21
7.2.70.0100.00317.04
7.2.60.0120.00817.03
7.2.50.0060.01016.92
7.2.40.0000.01416.64
7.2.30.0080.00416.99
7.2.20.0000.01116.79
7.2.10.0030.01016.86
7.2.00.0050.01218.26
7.1.330.0050.01115.92
7.1.320.0050.01115.66
7.1.310.0030.01015.63
7.1.300.0000.01415.89
7.1.290.0050.00815.69
7.1.280.0050.00915.73
7.1.270.0110.00315.94
7.1.260.0020.01215.82
7.1.250.0070.01015.96
7.1.200.0040.00715.95
7.1.70.0040.00417.28
7.1.60.0140.00017.33
7.1.00.0000.07722.35
7.0.200.0070.00716.86
7.0.120.0130.07022.10
7.0.110.0070.06022.15
7.0.100.0200.05722.06
7.0.90.0230.06022.05
7.0.80.0070.05322.09
7.0.70.0100.05322.05
7.0.60.0030.05722.08
7.0.50.0070.07322.13
7.0.40.0030.06322.12
7.0.30.0130.04722.04
7.0.20.0130.04722.07
7.0.10.0070.06022.04
7.0.00.0070.05322.11
5.6.270.0030.07721.00
5.6.260.0070.07721.07
5.6.250.0230.06321.12
5.6.240.0130.06321.02
5.6.230.0030.06320.89
5.6.220.0070.05720.95
5.6.210.0070.05720.96
5.6.200.0130.07020.88
5.6.190.0130.05720.84
5.6.180.0030.06021.04
5.6.170.0100.05021.03
5.6.160.0070.05320.96
5.6.150.0000.09020.85
5.6.140.0070.07320.84
5.6.130.0030.06021.05
5.6.120.0030.06020.86
5.6.110.0100.05721.06
5.6.100.0030.06020.98
5.6.90.0000.06020.99
5.6.80.0070.05320.40
5.6.70.0030.05720.36
5.6.60.0070.05720.13
5.6.50.0130.05720.48
5.6.40.0230.05020.41
5.6.30.0030.06020.46
5.6.20.0100.05020.36
5.6.10.0070.05320.12
5.6.00.0070.05020.39

preferences:
64.54 ms | 401 KiB | 5 Q