3v4l.org

run code in 300+ PHP versions simultaneously
<?php function gray_to_binary($value) { $dec = 0; $bits = floor(log($value, 2)); for ($i = $bits; $i >= 0; $i--) { $dec = $dec | (((($dec >> ($i + 1)) ^ ($value >> $i)) & 1) << $i); } return $dec; } function iterate_gray($value) { // get the equivalent starting binary value $code = decbin($value); yield $code; $len = strlen($code); $count = gray_to_binary($value); while ($count > 0) { // flip the bit which corresponds to the least signficiant 1 bit in $count $xor = 1; while (($count & $xor) == 0) $xor <<= 1; $value ^= $xor; yield sprintf("%0{$len}b", $value); $count--; } } foreach (iterate_gray(8) as $code) { echo $code . PHP_EOL; }

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.110.0080.00020.94
8.3.100.0030.00724.06
8.3.90.0090.00626.77
8.3.80.0030.00616.75
8.3.70.0100.01016.58
8.3.60.0110.00418.56
8.3.50.0090.00924.49
8.3.40.0080.00818.93
8.3.30.0090.00918.91
8.3.20.0070.00022.02
8.3.10.0000.00820.46
8.3.00.0040.00423.73
8.2.230.0040.01122.58
8.2.220.0090.00037.54
8.2.210.0090.00926.77
8.2.200.0070.00416.75
8.2.190.0140.00316.63
8.2.180.0030.01418.41
8.2.170.0040.01122.96
8.2.160.0150.00322.27
8.2.150.0070.00724.18
8.2.140.0050.00224.66
8.2.130.0050.00326.16
8.2.120.0040.00426.16
8.2.110.0100.00019.28
8.2.100.0060.00618.03
8.2.90.0000.00818.00
8.2.80.0040.00419.04
8.2.70.0040.00417.63
8.2.60.0000.00817.63
8.2.50.0090.00018.05
8.2.40.0000.00820.01
8.2.30.0000.00719.47
8.2.20.0000.00818.14
8.2.10.0020.00519.52
8.2.00.0070.00019.43
8.1.290.0030.00830.84
8.1.280.0090.00625.92
8.1.270.0060.00322.18
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.87
8.1.230.0110.00019.14
8.1.220.0030.00617.78
8.1.210.0000.00818.77
8.1.200.0060.00317.47
8.1.190.0000.00817.35
8.1.180.0040.00418.10
8.1.170.0050.00317.62
8.1.160.0000.00719.08
8.1.150.0050.00219.02
8.1.140.0070.00018.99
8.1.130.0030.00317.55
8.1.120.0030.00617.58
8.1.110.0040.00417.62
8.1.100.0040.00417.50
8.1.90.0040.00417.51
8.1.80.0040.00417.60
8.1.70.0000.00717.59
8.1.60.0030.00617.70
8.1.50.0080.00017.66
8.1.40.0040.00417.55
8.1.30.0060.00317.76
8.1.20.0030.00517.81
8.1.10.0040.00417.68
8.1.00.0040.00417.50
8.0.300.0040.00419.77
8.0.290.0000.00716.75
8.0.280.0030.00618.63
8.0.270.0000.00718.15
8.0.260.0030.00317.02
8.0.250.0050.00217.04
8.0.240.0050.00317.16
8.0.230.0070.00017.12
8.0.220.0040.00416.98
8.0.210.0000.00716.89
8.0.200.0030.00317.13
8.0.190.0040.00417.05
8.0.180.0030.00617.12
8.0.170.0060.00317.07
8.0.160.0050.00317.03
8.0.150.0000.00917.02
8.0.140.0040.00416.90
8.0.130.0000.00513.46
8.0.120.0040.00417.00
8.0.110.0040.00417.05
8.0.100.0030.00517.09
8.0.90.0090.00017.07
8.0.80.0090.01216.99
8.0.70.0070.00017.05
8.0.60.0040.00416.90
8.0.50.0040.00416.92
8.0.30.0000.01817.21
8.0.20.0140.00417.37
8.0.10.0070.00017.13
8.0.00.0100.01316.97
7.4.330.0000.00515.55
7.4.320.0020.00516.66
7.4.300.0040.00416.76
7.4.290.0070.00016.79
7.4.280.0000.00716.80
7.4.270.0070.00016.81
7.4.260.0030.00313.49
7.4.250.0030.00316.74
7.4.240.0000.00716.78
7.4.230.0000.00716.68
7.4.220.0000.00716.63
7.4.210.0060.01216.65
7.4.200.0000.00716.80
7.4.130.0120.01016.59
7.4.120.0080.01316.53
7.4.110.0130.00716.61
7.4.100.0080.01316.63
7.4.90.0140.00816.58
7.4.80.0120.00818.01
7.4.70.0070.01616.65
7.4.60.0150.00616.55
7.4.50.0120.01116.56
7.4.40.0090.01316.43
7.4.30.0080.01316.54
7.4.20.0090.00716.44
7.4.10.0150.00816.60
7.4.00.0110.01116.60
7.3.330.0040.00416.58
7.3.320.0030.00313.37
7.3.310.0000.00816.60
7.3.300.0030.00316.43
7.3.290.0060.00916.47
7.3.260.0180.00016.55
7.3.250.0150.00916.60
7.3.240.0110.00816.57
7.3.230.0120.00816.52
7.3.220.0040.01816.53
7.3.210.0090.01216.42
7.3.200.0060.01316.58
7.3.190.0070.01316.37
7.3.180.0090.01216.54
7.3.170.0160.00916.51
7.3.160.0170.00816.45
7.3.150.0130.00716.57
7.3.140.0140.01016.42
7.3.130.0060.01616.53
7.3.120.0120.00916.46
7.3.110.0160.00916.68
7.3.100.0070.01116.52
7.3.90.0100.01016.51
7.3.80.0080.01316.49
7.3.70.0120.00916.31
7.3.60.0160.00616.44
7.3.50.0110.00816.37
7.3.40.0050.01316.39
7.3.30.0080.01116.47
7.3.20.0120.01016.54
7.3.10.0140.01316.42
7.3.00.0210.00816.44
7.2.340.0180.01116.54
7.2.330.0080.01416.63
7.2.320.0110.01216.75
7.2.310.0240.00816.59
7.2.300.0120.01016.64
7.2.290.0140.00616.62
7.2.280.0090.01416.48
7.2.270.0130.01316.59
7.2.260.0150.01016.51
7.2.250.0140.00816.60
7.2.240.0160.00716.55
7.2.230.0070.01516.50
7.2.220.0210.00316.64
7.2.210.0110.01116.52
7.2.200.0130.00916.55
7.2.190.0180.00616.51
7.2.180.0140.01016.62
7.2.170.0150.00916.54
7.2.160.0180.00516.38
7.2.150.0160.01116.68
7.2.140.0130.01316.63
7.2.130.0180.00616.54
7.2.120.0130.01416.55
7.2.110.0130.00916.68
7.2.100.0080.01516.46
7.2.90.0090.01416.58
7.2.80.0480.01016.55
7.2.70.0180.00516.73
7.2.60.0090.01316.60
7.2.50.0110.01216.77
7.2.40.0110.01116.46
7.2.30.0220.00516.71
7.2.20.0120.01416.77
7.2.10.0190.00616.64
7.2.00.0180.01216.72

preferences:
27.31 ms | 403 KiB | 5 Q