3v4l.org

run code in 300+ PHP versions simultaneously
<?php function string_shift_left($input, $inputlen, $bits, &$output = null) { $skip = (int) ($bits / 8); $copylen = (int) ($inputlen - $skip); $offset = 8 - ($bits % 8); $mask = 0xff >> $offset; $output = str_pad('', $inputlen + 1, "\x00"); var_dump($skip, $copylen, $offset, $mask, $output); if ($offset == 8) { /* Shifting multiples of 8 allows us to simply copy the relevant bytes */ for ($i = 0; $i < $copylen; $i++) { $output[$i] = $input[$i + $skip]; } return; } for ($i = 0; $i < $copylen; $i++) { $output[$i] = chr((ord($input[$i + $skip]) << $offset) | (ord($input[$i + $skip + 1]) & $mask)); } } string_shift_left("\x01\x00", 1, 3, $output); for ($i = 0; $i < strlen($output); $i++) { printf('%08b', ord($output[$i])); }

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.0040.01118.29
8.3.50.0100.01022.02
8.3.40.0070.00718.54
8.3.30.0040.01118.99
8.3.20.0040.00420.34
8.3.10.0080.00022.00
8.3.00.0080.00022.46
8.2.180.0110.00718.26
8.2.170.0100.00322.96
8.2.160.0060.00819.33
8.2.150.0040.00424.18
8.2.140.0020.00524.66
8.2.130.0070.00726.16
8.2.120.0100.00017.75
8.2.110.0060.00321.12
8.2.100.0000.01217.91
8.2.90.0000.00917.75
8.2.80.0060.00318.73
8.2.70.0030.00617.63
8.2.60.0040.00417.50
8.2.50.0050.00317.75
8.2.40.0060.00617.63
8.2.30.0040.00718.07
8.2.20.0040.00417.76
8.2.10.0000.00717.70
8.2.00.0000.00817.67
8.1.280.0130.00625.92
8.1.270.0040.00422.20
8.1.260.0000.00726.35
8.1.250.0110.00428.09
8.1.240.0060.00323.95
8.1.230.0030.00720.97
8.1.220.0000.00817.79
8.1.210.0040.00418.77
8.1.200.0040.00417.48
8.1.190.0030.00517.35
8.1.180.0000.00818.10
8.1.170.0000.00817.62
8.1.160.0050.00521.98
8.1.150.0000.00718.57
8.1.140.0040.00417.52
8.1.130.0000.00717.88
8.1.120.0040.00417.34
8.1.110.0040.00417.47
8.1.100.0040.00417.32
8.1.90.0030.00617.41
8.1.80.0030.00417.43
8.1.70.0030.00317.47
8.1.60.0040.00417.52
8.1.50.0040.00417.43
8.1.40.0050.00217.47
8.1.30.0080.00017.63
8.1.20.0050.00317.56
8.1.10.0040.00417.63
8.1.00.0040.00417.50
8.0.300.0040.00418.93
8.0.290.0040.00416.63
8.0.280.0030.00318.48
8.0.270.0030.00317.31
8.0.260.0080.00016.82
8.0.250.0030.00316.86
8.0.240.0000.00716.97
8.0.230.0040.00416.82
8.0.220.0030.00316.90
8.0.210.0030.00316.95
8.0.200.0000.00616.85
8.0.190.0030.00316.83
8.0.180.0040.00416.78
8.0.170.0040.00416.96
8.0.160.0030.00517.02
8.0.150.0040.00416.88
8.0.140.0050.00316.79
8.0.130.0000.00713.42
8.0.120.0000.00816.80
8.0.110.0000.00816.83
8.0.100.0050.00316.88
8.0.90.0030.00516.97
8.0.80.0100.00516.84
8.0.70.0000.00716.74
8.0.60.0000.00716.89
8.0.50.0020.00516.94
8.0.30.0080.01217.02
8.0.20.0180.00517.40
8.0.10.0000.00816.88
8.0.00.0120.00716.82
7.4.330.0030.00315.00
7.4.320.0030.00316.51
7.4.300.0030.00316.46
7.4.290.0000.00716.52
7.4.280.0030.00516.58
7.4.270.0000.00716.63
7.4.260.0000.00716.59
7.4.250.0050.00316.43
7.4.240.0040.00416.57
7.4.230.0040.00416.48
7.4.220.0060.01316.54
7.4.210.0060.01016.57
7.4.200.0080.00016.60
7.4.190.0020.00516.61
7.4.160.0160.00616.51
7.4.150.0070.01017.40
7.4.140.0060.01217.86
7.4.130.0070.01316.44
7.4.120.0070.01216.53
7.4.110.0160.00016.66
7.4.100.0110.00716.39
7.4.90.0100.00716.43
7.4.80.0070.01419.39
7.4.70.0090.00916.63
7.4.60.0070.01016.70
7.4.50.0050.00316.32
7.4.40.0060.01222.77
7.4.30.0040.01416.71
7.4.00.0040.01414.85
7.3.330.0030.00213.34
7.3.320.0050.00013.25
7.3.310.0070.00016.40
7.3.300.0000.00716.39
7.3.290.0030.01316.40
7.3.280.0090.00716.38
7.3.270.0060.01217.40
7.3.260.0070.01016.52
7.3.250.0140.00316.58
7.3.240.0030.01416.60
7.3.230.0160.00616.63
7.3.210.0150.00316.52
7.3.200.0110.00519.39
7.3.190.0080.00916.38
7.3.180.0000.01516.67
7.3.170.0070.01016.60
7.3.160.0140.00316.47
7.3.120.0120.00015.03
7.2.330.0070.01016.64
7.2.320.0110.00916.55
7.2.310.0070.01116.73
7.2.300.0080.00916.93
7.2.290.0120.00916.58
7.2.80.0000.01116.57
7.2.00.0030.01219.54
7.1.200.0090.00015.67
7.1.100.0030.01018.32
7.1.70.0000.01117.14
7.1.60.0140.01119.82
7.1.50.0030.01417.02
7.1.00.0070.07322.33
7.0.200.0100.00316.46
7.0.140.0030.07322.12
7.0.60.0100.07319.84
7.0.50.0070.08317.93
7.0.40.0030.04320.04
7.0.30.0330.06320.10
7.0.20.0400.06320.24
7.0.10.0070.08020.33
7.0.00.0100.05320.16
5.6.280.0030.07321.13
5.6.210.0170.07020.67
5.6.200.0070.07318.18
5.6.190.0030.09320.51
5.6.180.0400.06720.50
5.6.170.0330.07720.56
5.6.160.0030.04720.39
5.6.150.0030.08318.16
5.6.140.0270.04318.12
5.6.130.0030.08318.11
5.6.120.0100.08020.92
5.6.110.0170.07321.02
5.6.100.0100.06721.00
5.6.90.0100.04720.89
5.6.80.0200.06320.30
5.5.350.0230.05020.34
5.5.340.0070.07318.04
5.5.330.0100.08020.36
5.5.320.0370.07020.39
5.5.310.0300.07320.29
5.5.300.0130.04717.97
5.5.290.0030.04017.95
5.5.280.0030.08321.00
5.5.270.0100.07020.97
5.5.260.0000.04320.90
5.5.250.0100.04020.56
5.5.240.0100.04020.36
5.4.450.0670.05319.56
5.4.440.0370.05319.13
5.4.430.0070.05719.43
5.4.420.0170.05019.52
5.4.410.0200.04718.93
5.4.400.0070.05718.73
5.4.390.0100.05018.84
5.4.380.0000.06318.71
5.4.370.0170.06018.48
5.4.360.0230.04318.84
5.4.350.0230.05018.70
5.4.340.0230.05018.63
5.4.320.0050.03812.51
5.4.310.0050.03812.51
5.4.300.0070.03612.51
5.4.290.0050.03812.51
5.4.280.0090.03112.41
5.4.270.0230.05718.93
5.4.260.0130.07319.11
5.4.250.0070.06718.86
5.4.240.0130.06018.92
5.4.230.0170.07019.00
5.4.220.0170.07718.93
5.4.210.0070.06318.93
5.4.200.0070.05318.76
5.4.190.0130.05718.86
5.4.180.0170.07318.83
5.4.170.0170.06019.02
5.4.160.0000.06718.91
5.4.150.0200.05318.90
5.4.140.0070.05716.57
5.4.130.0000.06316.56
5.4.120.0100.04716.40
5.4.110.0100.05016.38
5.4.100.0070.05016.41
5.4.90.0170.06716.62
5.4.80.0130.06716.45
5.4.70.0100.06016.46
5.4.60.0100.04716.59
5.4.50.0100.05016.59
5.4.40.0070.05316.41
5.4.30.0170.05016.59
5.4.20.0130.06316.36
5.4.10.0170.06016.39
5.4.00.0070.04716.03
5.3.290.0090.03612.80
5.3.280.0130.06714.67
5.3.270.0000.06314.69
5.3.260.0130.07014.62
5.3.250.0130.05714.59
5.3.240.0070.07314.70
5.3.230.0130.07014.83
5.3.220.0100.06014.56
5.3.210.0100.06314.58
5.3.200.0130.04714.67
5.3.190.0100.07314.80
5.3.180.0200.04014.58
5.3.170.0070.05314.76
5.3.160.0170.04314.57
5.3.150.0170.05314.64
5.3.140.0030.05314.64
5.3.130.0200.04314.54
5.3.120.0070.05714.55
5.3.110.0130.05014.64
5.3.100.0030.06313.88
5.3.90.0130.04714.12
5.3.80.0130.06314.01
5.3.70.0100.05714.11
5.3.60.0130.06013.98
5.3.50.0130.04714.02
5.3.40.0170.04714.04
5.3.30.0100.04714.00
5.3.20.0070.06013.79
5.3.10.0170.05313.49
5.3.00.0130.04713.88
5.2.170.0030.06011.24
5.2.160.0000.04311.22
5.2.150.0030.04711.12
5.2.140.0130.06011.22
5.2.130.0070.05711.20
5.2.120.0170.04711.13
5.2.110.0070.04010.95
5.2.100.0100.03711.06
5.2.90.0100.04311.34
5.2.80.0100.04711.16
5.2.70.0130.05311.07
5.2.60.0030.05711.29
5.2.50.0100.04311.13
5.2.40.0100.04011.17
5.2.30.0100.03711.05
5.2.20.0070.04710.80
5.2.10.0030.04711.05
5.2.00.0130.04710.81
5.1.60.0030.0409.98
5.1.50.0100.0439.99
5.1.40.0030.03710.23
5.1.30.0070.04310.32
5.1.20.0030.06010.43
5.1.10.0070.03710.32
5.1.00.0100.03310.06
5.0.50.0070.0278.63
5.0.40.0030.0408.54
5.0.30.0030.0578.21
5.0.20.0070.0408.41
5.0.10.0070.0408.29
5.0.00.0000.0478.27
4.4.90.0100.0206.88
4.4.80.0000.0336.88
4.4.70.0070.0276.88
4.4.60.0030.0236.88
4.4.50.0000.0236.88
4.4.40.0000.0436.88
4.4.30.0000.0336.88
4.4.20.0030.0306.88
4.4.10.0070.0206.88
4.4.00.0070.0376.88
4.3.110.0030.0306.88
4.3.100.0030.0306.88
4.3.90.0070.0236.88
4.3.80.0000.0476.88
4.3.70.0070.0206.88
4.3.60.0000.0236.88
4.3.50.0030.0206.88
4.3.40.0070.0376.88
4.3.30.0070.0206.88
4.3.20.0030.0206.88
4.3.10.0030.0276.88
4.3.00.0100.0206.69

preferences:
68.79 ms | 401 KiB | 5 Q