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 = ($bits % 8) & 0xff; $mask = ~(0xff >> (8 - $offset)) & 0xff; $output = str_pad('', $inputlen + 1, "\x00"); echo "$skip $copylen $offset $mask\n"; if ($offset == 0) { /* 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++) { $left = (ord($input[$i + $skip]) << $offset); $right = (ord($input[$i + $skip + 1]) & $mask) >> $offset; printf("%02x ", $left | $right); $output[$i] = chr($left | $right); } } //0b000100010001000100000000; $input = "abc\x00"; $bits = 2; string_shift_left($input, strlen($input) - 1, $bits, $output); for ($i = 0; $i < strlen($output); $i++) { printf("\n%02x", 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.0120.00618.18
8.3.50.0080.00922.00
8.3.40.0130.00318.70
8.3.30.0030.01119.10
8.3.20.0000.00720.11
8.3.10.0080.00022.09
8.3.00.0000.00722.27
8.2.180.0180.00316.47
8.2.170.0140.00722.96
8.2.160.0170.00019.29
8.2.150.0050.00324.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00419.18
8.2.110.0060.00322.13
8.2.100.0090.00319.57
8.2.90.0050.00319.21
8.2.80.0030.00517.97
8.2.70.0080.00017.38
8.2.60.0030.00617.93
8.2.50.0080.00018.07
8.2.40.0040.00418.16
8.2.30.0080.00418.14
8.2.20.0040.00417.75
8.2.10.0090.00017.77
8.2.00.0000.00717.79
8.1.280.0040.01425.92
8.1.270.0030.00522.24
8.1.260.0130.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00623.88
8.1.230.0000.01319.16
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0040.00417.38
8.1.190.0080.00017.54
8.1.180.0000.00818.10
8.1.170.0060.00318.64
8.1.160.0000.00722.00
8.1.150.0050.00318.70
8.1.140.0000.00717.38
8.1.130.0000.00717.83
8.1.120.0030.00517.45
8.1.110.0080.00017.36
8.1.100.0030.00417.46
8.1.90.0050.00317.36
8.1.80.0050.00217.48
8.1.70.0000.00717.48
8.1.60.0040.00417.57
8.1.50.0050.00217.43
8.1.40.0000.00717.50
8.1.30.0030.00517.61
8.1.20.0000.00817.52
8.1.10.0040.00417.64
8.1.00.0040.00417.40
8.0.300.0030.00518.77
8.0.290.0070.00017.18
8.0.280.0000.00718.47
8.0.270.0070.00017.18
8.0.260.0000.00716.86
8.0.250.0000.00717.00
8.0.240.0000.00816.99
8.0.230.0000.00716.88
8.0.220.0000.00716.90
8.0.210.0000.00716.95
8.0.200.0030.00317.02
8.0.190.0040.00416.87
8.0.180.0040.00416.90
8.0.170.0040.00416.84
8.0.160.0000.00916.81
8.0.150.0000.00716.88
8.0.140.0000.00716.80
8.0.130.0030.00313.35
8.0.120.0050.00216.87
8.0.110.0040.00416.90
8.0.100.0040.00416.84
8.0.90.0030.00516.73
8.0.80.0070.00816.91
8.0.70.0040.00416.87
8.0.60.0030.00516.94
8.0.50.0040.00416.93
8.0.30.0100.01217.09
8.0.20.0100.00917.40
8.0.10.0030.00617.04
8.0.00.0100.00916.78
7.4.330.0030.00315.00
7.4.320.0000.00616.45
7.4.300.0030.00316.63
7.4.290.0030.00316.60
7.4.280.0070.00016.65
7.4.270.0000.00716.63
7.4.260.0030.00316.43
7.4.250.0050.00216.51
7.4.240.0070.00016.60
7.4.230.0030.00316.51
7.4.220.0120.00616.60
7.4.210.0090.00816.63
7.4.200.0070.00016.42
7.4.190.0000.00716.62
7.4.160.0150.00816.43
7.4.150.0090.00917.40
7.4.140.0180.00517.86
7.4.130.0100.00916.46
7.4.120.0050.01316.54
7.4.110.0090.00816.38
7.4.100.0120.00916.59
7.4.90.0140.00316.60
7.4.80.0090.00919.39
7.4.70.0070.01016.68
7.4.60.0060.01016.45
7.4.50.0040.00416.51
7.4.40.0070.01022.77
7.4.30.0110.00516.49
7.4.00.0140.00015.03
7.3.330.0030.00313.38
7.3.320.0000.00513.32
7.3.310.0050.00216.26
7.3.300.0030.00316.43
7.3.290.0120.00716.35
7.3.280.0090.01016.38
7.3.270.0120.00417.40
7.3.260.0060.01016.31
7.3.250.0140.00816.60
7.3.240.0140.00716.39
7.3.230.0140.00616.39
7.3.210.0110.00616.39
7.3.200.0030.01419.39
7.3.190.0070.01016.27
7.3.180.0060.00916.43
7.3.170.0040.01116.39
7.3.160.0000.01516.61
7.3.120.0070.01014.80
7.3.10.0040.01216.44
7.3.00.0080.00316.41
7.2.330.0110.00816.68
7.2.320.0100.00716.56
7.2.310.0140.00316.93
7.2.300.0140.00416.57
7.2.290.0070.01016.79
7.2.130.0070.01016.77
7.2.120.0040.01117.08
7.2.110.0140.00317.04
7.2.100.0070.00717.04
7.2.90.0000.00817.04
7.2.80.0060.00316.90
7.2.70.0030.01316.99
7.2.60.0150.00517.01
7.2.50.0090.00616.97
7.2.40.0090.00616.86
7.2.30.0030.00717.09
7.2.20.0040.01216.76
7.2.10.0000.01316.83
7.2.00.0070.01117.16
7.1.250.0100.00315.80
7.1.200.0120.00315.84
7.1.100.0060.00618.33
7.1.70.0030.00717.04
7.1.60.0090.01519.82
7.1.50.0070.01316.70
7.1.00.0070.08722.57
7.0.200.0070.00416.45
7.0.140.0030.07322.02
7.0.60.0100.06720.04
7.0.50.0170.02717.89
7.0.40.0030.05320.24
7.0.30.0230.04020.06
7.0.20.0130.07320.07
7.0.10.0100.07320.08
7.0.00.0000.04720.29
5.6.280.0070.07020.79
5.6.210.0130.06320.54
5.6.200.0100.04018.29
5.6.190.0100.06720.55
5.6.180.0300.08020.57
5.6.170.0330.05020.43
5.6.160.0100.08020.55
5.6.150.0030.06018.16
5.6.140.0070.08018.18
5.6.130.0070.05318.19
5.6.120.0070.08721.12
5.6.110.0100.07721.03
5.6.100.0100.07721.10
5.6.90.0130.07721.14
5.6.80.0000.04320.50
5.6.70.3930.04320.43
5.5.350.0100.07020.43
5.5.340.0030.08318.09
5.5.330.0100.08020.43
5.5.320.0170.06320.31
5.5.310.0200.07720.35
5.5.300.0100.06717.95
5.5.290.0070.04018.04
5.5.280.0100.05720.84
5.5.270.0030.04020.78
5.5.260.0070.09020.66
5.5.250.0030.07720.59
5.5.240.0070.04020.27
5.4.450.0400.07019.48
5.4.440.0700.05319.55
5.4.430.0130.05319.68
5.4.420.0130.06719.63
5.4.410.0030.06719.31
5.4.400.0070.05318.54
5.4.390.0270.03318.82
5.4.380.0230.06018.52
5.4.370.0430.05018.79
5.4.360.0170.05318.79
5.4.350.0300.05318.61
5.4.340.0330.05318.57
5.4.320.0020.03912.51
5.4.310.0060.03712.51
5.4.300.0090.03712.51
5.4.290.0060.03712.51
5.4.280.0040.04812.40
5.4.270.0000.07318.91
5.4.260.0100.05318.72
5.4.250.0100.08018.89
5.4.240.0100.07718.97
5.4.230.0070.08018.95
5.4.220.0100.05318.91
5.4.210.0100.08019.04
5.4.200.0130.05018.88
5.4.190.0070.05718.85
5.4.180.0170.06018.60
5.4.170.0200.05718.78
5.4.160.0170.05718.73
5.4.150.0130.08018.59
5.4.140.0130.04716.56
5.4.130.0070.06016.37
5.4.120.0230.05716.34
5.4.110.0030.05716.46
5.4.100.0100.05316.49
5.4.90.0100.05716.31
5.4.80.0200.05016.30
5.4.70.0070.06316.55
5.4.60.0070.07316.43
5.4.50.0200.05016.42
5.4.40.0100.05316.39
5.4.30.0170.04316.43
5.4.20.0070.05016.28
5.4.10.0270.05716.52
5.4.00.0230.06015.86
5.3.290.0030.04312.80
5.3.280.0100.04714.84
5.3.270.0070.05714.84
5.3.260.0100.05014.70
5.3.250.0100.07314.84
5.3.240.0070.05714.64
5.3.230.0030.07714.70
5.3.220.0030.08014.56
5.3.210.0170.06314.59
5.3.200.0300.08314.67
5.3.190.0070.05714.80
5.3.180.0130.07014.76
5.3.170.0170.07314.66
5.3.160.0200.05714.68
5.3.150.0100.05014.58
5.3.140.0070.06314.70
5.3.130.0170.07014.79
5.3.120.0130.06714.79
5.3.110.0100.05314.63
5.3.100.0100.05714.13
5.3.90.0070.05314.09
5.3.80.0200.05314.04
5.3.70.0030.06014.20
5.3.60.0100.06014.04
5.3.50.0130.06314.06
5.3.40.0070.05014.09
5.3.30.0100.05014.01
5.3.20.0170.06013.93
5.3.10.0130.06713.56
5.3.00.0200.05713.72
5.2.170.0000.05311.14
5.2.160.0100.05011.11
5.2.150.0130.06011.14
5.2.140.0130.05711.05
5.2.130.0100.04311.29
5.2.120.0100.05311.09
5.2.110.0070.04311.19
5.2.100.0070.04011.18
5.2.90.0030.06011.30
5.2.80.0030.07011.18
5.2.70.0100.06011.05
5.2.60.0130.05311.23
5.2.50.0030.04311.11
5.2.40.0070.04010.85
5.2.30.0100.04311.20
5.2.20.0200.02711.15
5.2.10.0070.05310.86
5.2.00.0030.04010.70
5.1.60.0030.05010.06
5.1.50.0170.04010.08
5.1.40.0130.0309.91
5.1.30.0130.03310.53
5.1.20.0030.05010.34
5.1.10.0070.04010.04
5.1.00.0100.04010.23
5.0.50.0100.0278.57
5.0.40.0100.0338.52
5.0.30.0030.0578.39
5.0.20.0100.0338.28
5.0.10.0130.0308.24
5.0.00.0100.0538.38
4.4.90.0070.0176.88
4.4.80.0000.0276.88
4.4.70.0030.0236.88
4.4.60.0070.0206.88
4.4.50.0100.0306.88
4.4.40.0070.0376.88
4.4.30.0030.0236.88
4.4.20.0070.0176.88
4.4.10.0000.0236.88
4.4.00.0100.0276.88
4.3.110.0000.0276.88
4.3.100.0070.0206.88
4.3.90.0070.0236.88
4.3.80.0000.0436.88
4.3.70.0100.0236.88
4.3.60.0130.0206.88
4.3.50.0100.0206.88
4.3.40.0070.0436.88
4.3.30.0000.0236.88
4.3.20.0030.0276.88
4.3.10.0000.0236.88
4.3.00.0100.0207.38

preferences:
41.97 ms | 400 KiB | 5 Q