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: %08b", ord($output[$i]), 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.0150.00818.18
8.3.50.0240.00521.99
8.3.40.0080.00818.84
8.3.30.0070.00719.04
8.3.20.0000.00920.29
8.3.10.0050.00322.15
8.3.00.0070.00022.52
8.2.180.0060.01216.75
8.2.170.0070.01122.96
8.2.160.0070.00719.19
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00417.61
8.2.110.0030.00622.25
8.2.100.0080.00318.22
8.2.90.0020.00519.31
8.2.80.0090.00018.05
8.2.70.0060.00317.50
8.2.60.0090.00317.80
8.2.50.0030.00518.07
8.2.40.0030.00618.22
8.2.30.0070.00318.20
8.2.20.0040.00417.65
8.2.10.0000.00917.67
8.2.00.0000.00717.68
8.1.280.0100.00725.92
8.1.270.0000.00822.05
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0090.00023.77
8.1.230.0090.00319.16
8.1.220.0110.00017.76
8.1.210.0040.00418.77
8.1.200.0030.00617.47
8.1.190.0040.00417.51
8.1.180.0080.00018.10
8.1.170.0040.00418.68
8.1.160.0000.00722.01
8.1.150.0030.00618.59
8.1.140.0000.00817.49
8.1.130.0000.00717.85
8.1.120.0070.00017.38
8.1.110.0080.00017.47
8.1.100.0030.00317.35
8.1.90.0000.00717.45
8.1.80.0000.00817.54
8.1.70.0000.00717.44
8.1.60.0080.00017.53
8.1.50.0040.00417.53
8.1.40.0040.00417.52
8.1.30.0040.00417.66
8.1.20.0020.00517.65
8.1.10.0060.00317.51
8.1.00.0050.00217.45
8.0.300.0050.00218.77
8.0.290.0000.00717.30
8.0.280.0030.00318.52
8.0.270.0030.00317.31
8.0.260.0000.00716.75
8.0.250.0000.00716.87
8.0.240.0050.00216.93
8.0.230.0030.00316.86
8.0.220.0030.00316.80
8.0.210.0000.00716.91
8.0.200.0030.00316.95
8.0.190.0000.00716.83
8.0.180.0000.00716.95
8.0.170.0030.00516.96
8.0.160.0030.00616.85
8.0.150.0040.00416.75
8.0.140.0050.00316.77
8.0.130.0050.00013.32
8.0.120.0020.00516.89
8.0.110.0080.00016.91
8.0.100.0050.00316.97
8.0.90.0030.00416.93
8.0.80.0030.01216.83
8.0.70.0040.00416.94
8.0.60.0000.00816.90
8.0.50.0000.00716.78
8.0.30.0130.00617.01
8.0.20.0090.00917.40
8.0.10.0070.00317.02
8.0.00.0140.00516.86
7.4.330.0000.00715.00
7.4.320.0060.00016.50
7.4.300.0070.00016.50
7.4.290.0030.00316.53
7.4.280.0050.00316.55
7.4.270.0000.00916.45
7.4.260.0000.00716.52
7.4.250.0060.00316.48
7.4.240.0020.00516.61
7.4.230.0000.00716.62
7.4.220.0160.01016.62
7.4.210.0040.01016.58
7.4.200.0050.00216.51
7.4.190.0070.00016.70
7.4.160.0060.01316.63
7.4.150.0060.01117.40
7.4.140.0140.00617.86
7.4.130.0140.00616.49
7.4.120.0110.00516.54
7.4.110.0130.00316.67
7.4.100.0090.01016.52
7.4.90.0090.00916.45
7.4.80.0170.00419.39
7.4.70.0090.00916.71
7.4.60.0080.00816.65
7.4.50.0000.00816.57
7.4.40.0030.00822.77
7.4.30.0070.01016.52
7.4.00.0100.00715.02
7.3.330.0000.00713.31
7.3.320.0060.00013.20
7.3.310.0000.00716.42
7.3.300.0060.00016.25
7.3.290.0050.01016.38
7.3.280.0110.00516.38
7.3.270.0060.01217.40
7.3.260.0130.00716.45
7.3.250.0130.00816.52
7.3.240.0080.00816.63
7.3.230.0120.00616.39
7.3.210.0060.01116.29
7.3.200.0060.01119.39
7.3.190.0090.01216.41
7.3.180.0000.02116.34
7.3.170.0140.00316.35
7.3.160.0110.00516.41
7.3.120.0030.01415.16
7.2.330.0060.01216.55
7.2.320.0090.00916.74
7.2.310.0120.00616.84
7.2.300.0110.00616.36
7.2.290.0060.01216.44
7.2.00.0040.00919.18
7.1.100.0110.00018.31
7.1.70.0000.01617.21
7.1.60.0070.01819.82
7.1.50.0000.01817.02
7.1.00.0000.08022.30
7.0.200.0070.00716.47
7.0.140.0000.07721.97
7.0.60.0130.07720.07
7.0.50.0070.04017.94
7.0.40.0030.09320.21
7.0.30.0330.05320.08
7.0.20.0170.04720.12
7.0.10.0130.04320.33
7.0.00.0170.03720.12
5.6.280.0030.07321.00
5.6.210.0030.09320.62
5.6.200.0100.08018.16
5.6.190.0000.06020.46
5.6.180.5000.04320.77
5.6.170.0270.07320.48
5.6.160.0100.04020.45
5.6.150.0100.04018.28
5.6.140.0100.05718.12
5.6.130.0030.05318.25
5.6.120.0100.07021.02
5.6.110.0130.07721.00
5.6.100.0070.08320.99
5.6.90.0030.07721.09
5.6.80.0100.04320.55
5.6.70.0330.07020.36
5.5.350.0170.07320.34
5.5.340.0070.06717.99
5.5.330.0070.07020.33
5.5.320.0130.04720.31
5.5.310.0170.04320.27
5.5.300.0030.04018.07
5.5.290.0100.07018.02
5.5.280.0100.04020.88
5.5.270.0100.04720.98
5.5.260.0170.04020.88
5.5.250.0070.08320.51
5.5.240.0100.07020.38
5.4.450.0830.05719.33
5.4.440.0670.08019.45
5.4.430.0070.05719.41
5.4.420.0070.05719.32
5.4.410.0030.06019.46
5.4.400.0100.05718.66
5.4.390.0030.06018.74
5.4.380.0400.06018.48
5.4.370.0230.05018.52
5.4.360.0230.04718.49
5.4.350.0170.06018.59
5.4.340.0130.05318.48
5.4.320.0050.03712.52
5.4.310.0050.03712.50
5.4.300.0040.03912.52
5.4.290.0050.03812.51
5.4.280.0040.03912.41
5.4.270.0030.06018.75
5.4.260.0130.06318.91
5.4.250.0170.06718.96
5.4.240.0170.05718.91
5.4.230.0030.06018.91
5.4.220.0230.06718.70
5.4.210.0030.06318.70
5.4.200.0230.04318.91
5.4.190.0230.06318.88
5.4.180.0170.05318.74
5.4.170.0030.06718.90
5.4.160.0200.07018.77
5.4.150.0130.06018.70
5.4.140.0100.05716.47
5.4.130.0130.04716.37
5.4.120.0170.05016.34
5.4.110.0030.06016.48
5.4.100.0130.05316.32
5.4.90.0130.05716.29
5.4.80.0170.06316.44
5.4.70.0070.05316.45
5.4.60.0170.07016.39
5.4.50.0100.06716.42
5.4.40.0070.05316.45
5.4.30.0030.07316.27
5.4.20.0130.04716.33
5.4.10.0200.06316.48
5.4.00.0070.06015.88
5.3.290.0040.04112.80
5.3.280.0100.05014.61
5.3.270.0130.05714.71
5.3.260.0130.06714.71
5.3.250.0070.06014.70
5.3.240.0170.06314.84
5.3.230.0100.07014.70
5.3.220.0130.07014.75
5.3.210.0130.05014.80
5.3.200.0070.05314.66
5.3.190.0130.05014.67
5.3.180.0070.08014.41
5.3.170.0130.05714.66
5.3.160.0070.05314.59
5.3.150.0030.07314.57
5.3.140.0100.05714.41
5.3.130.0130.06714.54
5.3.120.0200.07314.55
5.3.110.0070.05314.64
5.3.100.0200.05714.12
5.3.90.0070.06714.25
5.3.80.0070.05014.11
5.3.70.0100.06714.11
5.3.60.0130.05713.84
5.3.50.0130.05314.04
5.3.40.0170.04314.18
5.3.30.0070.05014.00
5.3.20.0100.05013.78
5.3.10.0130.04713.73
5.3.00.0130.06313.67
5.2.170.0170.05711.14
5.2.160.0030.05011.16
5.2.150.0130.05311.14
5.2.140.0100.04011.38
5.2.130.0030.04711.21
5.2.120.0000.05011.09
5.2.110.0130.04011.29
5.2.100.0100.05011.10
5.2.90.0070.05710.95
5.2.80.0030.05310.95
5.2.70.0030.04711.20
5.2.60.0100.05310.91
5.2.50.0100.05710.99
5.2.40.0100.05011.19
5.2.30.0030.04011.07
5.2.20.0130.04710.80
5.2.10.0030.05710.86
5.2.00.0100.04010.82
5.1.60.0070.03310.08
5.1.50.0130.0309.93
5.1.40.0070.0509.95
5.1.30.0100.04710.51
5.1.20.0100.05010.20
5.1.10.0100.03710.05
5.1.00.0100.04010.18
5.0.50.0130.0238.61
5.0.40.0100.0238.48
5.0.30.0030.0438.23
5.0.20.0100.0338.30
5.0.10.0070.0278.26
5.0.00.0000.0478.25
4.4.90.0070.0236.88
4.4.80.0030.0206.88
4.4.70.0130.0206.88
4.4.60.0000.0236.88
4.4.50.0030.0236.88
4.4.40.0030.0476.88
4.4.30.0000.0306.88
4.4.20.0030.0276.88
4.4.10.0030.0236.88
4.4.00.0000.0506.88
4.3.110.0100.0176.88
4.3.100.0030.0206.88
4.3.90.0100.0206.88
4.3.80.0000.0406.88
4.3.70.0130.0176.88
4.3.60.0070.0176.88
4.3.50.0030.0306.88
4.3.40.0130.0236.88
4.3.30.0000.0236.88
4.3.20.0030.0206.88
4.3.10.0030.0276.88
4.3.00.0130.0207.38

preferences:
37.5 ms | 401 KiB | 5 Q