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; $mask = (0xff >> $offset) << (8 - $offset); $output = str_pad('', $inputlen + 1, "\x00"); var_dump($skip, $copylen, $offset, $mask, $output); 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(chr(ord($input[$i + $skip]) << $offset)); $right = ord(chr(ord($input[$i + $skip + 1]) & $mask)); printf("%08b|%08b\n", $left, $right); $output[$i] = chr($left | $right); } } string_shift_left("\x11\x11\x00", 2, 7, $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.0160.00318.18
8.3.50.0120.00521.98
8.3.40.0120.00418.65
8.3.30.0070.00719.18
8.3.20.0030.00520.34
8.3.10.0070.00022.10
8.3.00.0040.00422.43
8.2.180.0090.00616.63
8.2.170.0110.00322.96
8.2.160.0120.00619.34
8.2.150.0070.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0000.00817.63
8.2.110.0070.00322.08
8.2.100.0120.00017.91
8.2.90.0040.00417.72
8.2.80.0050.00517.97
8.2.70.0040.00417.38
8.2.60.0050.00517.93
8.2.50.0040.00718.07
8.2.40.0040.00418.22
8.2.30.0050.00618.16
8.2.20.0000.00817.72
8.2.10.0040.00419.61
8.2.00.0050.00217.83
8.1.280.0170.00325.92
8.1.270.0040.00422.19
8.1.260.0070.00026.35
8.1.250.0000.00728.09
8.1.240.0060.00322.59
8.1.230.0070.00320.81
8.1.220.0050.00317.78
8.1.210.0030.00619.05
8.1.200.0030.00617.35
8.1.190.0000.00717.53
8.1.180.0080.00018.10
8.1.170.0080.00018.59
8.1.160.0040.00422.01
8.1.150.0000.00818.60
8.1.140.0050.00217.40
8.1.130.0040.00417.90
8.1.120.0000.00817.51
8.1.110.0040.00417.40
8.1.100.0040.00417.52
8.1.90.0000.00717.46
8.1.80.0070.00017.49
8.1.70.0030.00317.46
8.1.60.0000.00817.48
8.1.50.0040.00417.55
8.1.40.0040.00417.51
8.1.30.0000.00817.67
8.1.20.0080.00017.73
8.1.10.0060.00317.66
8.1.00.0050.00317.41
8.0.300.0050.00319.98
8.0.290.0000.00817.16
8.0.280.0040.00418.34
8.0.270.0040.00417.23
8.0.260.0030.00316.71
8.0.250.0070.00016.87
8.0.240.0080.00017.04
8.0.230.0030.00316.96
8.0.220.0000.00816.81
8.0.210.0000.00716.89
8.0.200.0030.00317.04
8.0.190.0040.00416.89
8.0.180.0000.00716.90
8.0.170.0000.00816.87
8.0.160.0040.00416.88
8.0.150.0030.00516.74
8.0.140.0000.00716.82
8.0.130.0000.00713.31
8.0.120.0060.00316.77
8.0.110.0000.00716.79
8.0.100.0030.00516.80
8.0.90.0030.00516.86
8.0.80.0170.00316.89
8.0.70.0030.00416.82
8.0.60.0040.00416.76
8.0.50.0050.00216.78
8.0.30.0100.01317.14
8.0.20.0160.00217.40
8.0.10.0070.00016.83
8.0.00.0060.01116.81
7.4.330.0050.00315.00
7.4.320.0040.00416.61
7.4.300.0030.00316.57
7.4.290.0000.00716.54
7.4.280.0030.00316.51
7.4.270.0020.00516.64
7.4.260.0000.00716.52
7.4.250.0000.00716.38
7.4.240.0020.00516.57
7.4.230.0000.00816.50
7.4.220.0130.01316.46
7.4.210.0060.01016.57
7.4.200.0030.00316.69
7.4.190.0030.00316.76
7.4.160.0100.00516.45
7.4.150.0100.00717.40
7.4.140.0140.00417.86
7.4.130.0160.00416.52
7.4.120.0080.01216.56
7.4.110.0120.00616.68
7.4.100.0100.00716.62
7.4.90.0080.00816.56
7.4.80.0130.00319.39
7.4.70.0030.01416.45
7.4.60.0130.00316.59
7.4.50.0030.00516.59
7.4.40.0070.00722.77
7.4.30.0060.00916.58
7.4.00.0100.00714.83
7.3.330.0020.00213.24
7.3.320.0030.00313.29
7.3.310.0000.00816.43
7.3.300.0000.00716.38
7.3.290.0090.01116.38
7.3.280.0080.00916.38
7.3.270.0120.00617.40
7.3.260.0170.00016.40
7.3.250.0080.00916.49
7.3.240.0120.00916.29
7.3.230.0090.00816.39
7.3.210.0100.00616.52
7.3.200.0080.00819.39
7.3.190.0110.00616.66
7.3.180.0110.00416.63
7.3.170.0030.01216.46
7.3.160.0100.00716.34
7.3.120.0090.00614.79
7.3.10.0070.00316.75
7.3.00.0080.00416.64
7.2.330.0100.01016.52
7.2.320.0070.01016.54
7.2.310.0120.00616.87
7.2.300.0080.01416.74
7.2.290.0100.01316.82
7.2.130.0090.00016.78
7.2.120.0060.00616.98
7.2.110.0030.00917.06
7.2.100.0030.00616.82
7.2.90.0030.01016.97
7.2.80.0100.00016.93
7.2.70.0030.00917.02
7.2.60.0060.00616.68
7.2.50.0030.00616.93
7.2.40.0060.00616.93
7.2.30.0120.00017.03
7.2.20.0070.00416.78
7.2.10.0030.00917.02
7.2.00.0090.00218.03
7.1.250.0090.00015.98
7.1.100.0040.00818.04
7.1.70.0070.00017.01
7.1.60.0070.01719.82
7.1.50.0090.01217.14
7.1.00.0070.07322.44
7.0.200.0170.00716.82
7.0.140.0000.07721.99
7.0.60.0200.07320.01
7.0.50.0100.05717.87
7.0.40.0070.04720.24
7.0.30.0270.05020.21
7.0.20.0370.04320.10
7.0.10.0100.08720.24
7.0.00.0100.08320.16
5.6.280.0100.07021.09
5.6.210.0000.04320.71
5.6.200.0100.08318.18
5.6.190.0030.04720.57
5.6.180.0370.04720.63
5.6.170.0230.07320.53
5.6.160.0070.08320.43
5.6.150.0070.05018.19
5.6.140.0100.05018.21
5.6.130.0070.07318.28
5.6.120.0070.04321.06
5.6.110.0070.08721.01
5.6.100.0200.06320.97
5.6.90.0030.04021.03
5.6.80.0030.06020.46
5.5.350.0270.07720.43
5.5.340.0030.06318.02
5.5.330.0070.08320.47
5.5.320.0270.04720.23
5.5.310.0330.07320.24
5.5.300.0030.08317.96
5.5.290.0070.04717.95
5.5.280.0100.07720.66
5.5.270.0170.06720.96
5.5.260.0130.06320.99
5.5.250.0030.06020.70
5.5.240.0030.06320.20
5.4.450.0700.05319.32
5.4.440.0700.06019.58
5.4.430.0070.05719.32
5.4.420.0130.05319.62
5.4.410.0130.04718.96
5.4.400.0130.05018.74
5.4.390.0200.06318.52
5.4.380.0170.04318.90
5.4.370.0170.05318.74
5.4.360.0170.05318.86
5.4.350.0170.05718.52
5.4.340.0200.05318.55
5.4.320.0070.03612.52
5.4.310.0070.04212.51
5.4.300.0040.05012.52
5.4.290.0080.04312.51
5.4.280.0060.03412.41
5.4.270.0200.06718.80
5.4.260.0130.07719.02
5.4.250.0270.06318.96
5.4.240.0070.06018.74
5.4.230.0070.05318.95
5.4.220.0130.07718.99
5.4.210.0170.08018.93
5.4.200.0070.05319.00
5.4.190.0130.06319.02
5.4.180.0070.06318.65
5.4.170.0170.05718.78
5.4.160.0030.05318.73
5.4.150.0200.05018.73
5.4.140.0070.06716.55
5.4.130.0200.05016.54
5.4.120.0130.05016.39
5.4.110.0070.05716.41
5.4.100.0100.05316.48
5.4.90.0070.05016.47
5.4.80.0030.06016.49
5.4.70.0170.04016.45
5.4.60.0130.04716.52
5.4.50.0200.04316.57
5.4.40.0200.05316.43
5.4.30.0200.06316.43
5.4.20.0170.06716.45
5.4.10.0170.07016.47
5.4.00.0100.06315.86
5.3.290.0060.04912.80
5.3.280.0200.06314.61
5.3.270.0170.06714.71
5.3.260.0100.05714.71
5.3.250.0130.06014.61
5.3.240.0130.06714.84
5.3.230.0030.06314.70
5.3.220.0100.05014.66
5.3.210.0100.05714.57
5.3.200.0200.05014.72
5.3.190.0200.05714.55
5.3.180.0100.05014.68
5.3.170.0200.04014.48
5.3.160.0130.06714.42
5.3.150.0070.07314.58
5.3.140.0070.06014.79
5.3.130.0070.05714.54
5.3.120.0100.06714.57
5.3.110.0100.05714.65
5.3.100.0130.05314.13
5.3.90.0170.04314.05
5.3.80.0030.05314.03
5.3.70.0100.05314.11
5.3.60.0030.07714.02
5.3.50.0070.06014.13
5.3.40.0070.06014.19
5.3.30.0100.07014.14
5.3.20.0070.05313.68
5.3.10.0170.06013.63
5.3.00.0000.06313.64
5.2.170.0270.02711.32
5.2.160.0170.04311.14
5.2.150.0100.04011.14
5.2.140.0130.05310.98
5.2.130.0070.04011.18
5.2.120.0030.04311.30
5.2.110.0070.05311.20
5.2.100.0100.06710.95
5.2.90.0130.03711.02
5.2.80.0100.05711.19
5.2.70.0100.04011.17
5.2.60.0070.05711.13
5.2.50.0130.04711.12
5.2.40.0070.05710.98
5.2.30.0170.04710.96
5.2.20.0070.05011.05
5.2.10.0030.04310.83
5.2.00.0070.05710.70
5.1.60.0130.02710.10
5.1.50.0070.03310.00
5.1.40.0100.0379.95
5.1.30.0070.05310.52
5.1.20.0070.03710.45
5.1.10.0030.05010.06
5.1.00.0070.03710.00
5.0.50.0070.0378.41
5.0.40.0170.0338.49
5.0.30.0030.0438.20
5.0.20.0130.0238.41
5.0.10.0000.0308.28
5.0.00.0100.0538.16
4.4.90.0070.0276.91
4.4.80.0030.0236.91
4.4.70.0100.0236.91
4.4.60.0070.0206.91
4.4.50.0030.0306.91
4.4.40.0000.0406.91
4.4.30.0030.0236.91
4.4.20.0030.0306.91
4.4.10.0000.0276.91
4.4.00.0000.0376.91
4.3.110.0070.0276.91
4.3.100.0000.0336.87
4.3.90.0070.0236.87
4.3.80.0030.0336.87
4.3.70.0070.0276.87
4.3.60.0030.0276.87
4.3.50.0000.0336.87
4.3.40.0130.0476.87
4.3.30.0030.0236.87
4.3.20.0000.0276.87
4.3.10.0030.0236.87
4.3.00.0170.0236.72

preferences:
35.66 ms | 401 KiB | 5 Q