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($input[$i + $skip]) << $offset); $right = (ord($input[$i + $skip + 1]) & $mask) >> $offset; printf("%08b|%08b\n", $left, $right); $output[$i] = chr($left | $right); } } //0b000100010001000100000000; string_shift_left("\x11\x11\x00", 2, 4, $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.0100.01018.43
8.3.50.0080.01222.04
8.3.40.0040.01118.84
8.3.30.0100.00319.21
8.3.20.0050.00320.20
8.3.10.0070.00022.08
8.3.00.0050.00322.46
8.2.180.0070.01116.35
8.2.170.0140.00022.96
8.2.160.0110.00319.34
8.2.150.0000.00824.18
8.2.140.0050.00324.66
8.2.130.0050.00526.16
8.2.120.0000.00817.63
8.2.110.0100.00022.22
8.2.100.0140.00017.49
8.2.90.0080.00019.21
8.2.80.0000.00817.97
8.2.70.0000.00917.63
8.2.60.0050.00318.16
8.2.50.0100.00018.07
8.2.40.0070.00018.22
8.2.30.0040.00818.05
8.2.20.0000.00717.72
8.2.10.0050.00217.77
8.2.00.0050.00317.64
8.1.280.0130.00725.92
8.1.270.0040.00422.05
8.1.260.0050.00226.35
8.1.250.0040.00428.09
8.1.240.0090.00023.82
8.1.230.0120.00018.96
8.1.220.0000.00717.79
8.1.210.0000.00818.77
8.1.200.0000.01217.35
8.1.190.0040.00417.53
8.1.180.0000.00918.10
8.1.170.0050.00318.65
8.1.160.0040.00422.09
8.1.150.0050.00218.66
8.1.140.0070.00017.41
8.1.130.0000.00717.77
8.1.120.0040.00417.45
8.1.110.0050.00317.48
8.1.100.0070.00017.38
8.1.90.0000.00817.38
8.1.80.0040.00417.36
8.1.70.0000.00717.40
8.1.60.0030.00617.49
8.1.50.0080.00017.38
8.1.40.0040.00417.56
8.1.30.0050.00217.64
8.1.20.0030.00517.67
8.1.10.0030.00517.64
8.1.00.0000.00717.52
8.0.300.0070.00018.77
8.0.290.0050.00217.18
8.0.280.0030.00318.38
8.0.270.0070.00017.20
8.0.260.0000.00716.75
8.0.250.0000.00816.97
8.0.240.0040.00416.96
8.0.230.0030.00316.87
8.0.220.0050.00216.82
8.0.210.0040.00416.91
8.0.200.0060.00016.97
8.0.190.0080.00017.02
8.0.180.0030.00616.95
8.0.170.0000.00817.00
8.0.160.0040.00416.93
8.0.150.0000.00716.83
8.0.140.0050.00316.84
8.0.130.0030.00313.31
8.0.120.0030.00516.92
8.0.110.0040.00416.76
8.0.100.0030.00516.79
8.0.90.0000.00716.98
8.0.80.0060.00916.96
8.0.70.0000.00816.70
8.0.60.0070.00016.97
8.0.50.0040.00417.03
8.0.30.0100.01117.05
8.0.20.0120.00717.40
8.0.10.0000.00817.07
8.0.00.0070.01016.75
7.4.330.0030.00315.00
7.4.320.0000.00616.58
7.4.300.0030.00316.55
7.4.290.0030.00316.60
7.4.280.0000.00716.62
7.4.270.0030.00316.66
7.4.260.0030.00316.62
7.4.250.0040.00416.63
7.4.240.0010.00616.58
7.4.230.0030.00316.28
7.4.220.0150.00716.65
7.4.210.0060.00916.65
7.4.200.0030.00316.60
7.4.190.0000.00716.78
7.4.160.0000.01616.62
7.4.150.0120.00617.40
7.4.140.0090.01217.86
7.4.130.0120.00516.44
7.4.120.0090.00816.63
7.4.110.0100.01316.35
7.4.100.0090.01516.43
7.4.90.0030.01316.66
7.4.80.0070.01319.39
7.4.70.0100.00716.45
7.4.60.0080.00816.48
7.4.50.0000.00816.37
7.4.40.0040.00822.77
7.4.30.0110.00916.37
7.4.00.0000.01114.92
7.3.330.0020.00213.39
7.3.320.0060.00013.17
7.3.310.0040.00416.26
7.3.300.0000.00716.40
7.3.290.0160.00316.39
7.3.280.0100.01016.39
7.3.270.0080.00817.40
7.3.260.0140.00316.43
7.3.250.0120.00516.55
7.3.240.0060.01616.34
7.3.230.0120.00416.43
7.3.210.0130.01016.47
7.3.200.0060.01319.39
7.3.190.0130.00416.46
7.3.180.0070.01016.29
7.3.170.0090.00616.41
7.3.160.0060.01216.30
7.3.120.0060.00915.13
7.2.330.0120.00616.86
7.2.320.0030.02016.87
7.2.310.0090.01216.67
7.2.300.0120.00616.51
7.2.290.0070.00916.96
7.2.60.0000.01517.06
7.2.00.0030.01219.48
7.1.200.0080.00615.85
7.1.100.0060.00618.08
7.1.70.0040.00417.28
7.1.60.0100.01419.82
7.1.50.0030.01016.98
7.1.00.0030.09022.57
7.0.200.0060.00616.72
7.0.140.0030.07322.04
7.0.60.0100.07719.89
7.0.50.0070.08317.91
7.0.40.0100.08319.96
7.0.30.0170.04320.08
7.0.20.0200.04720.08
7.0.10.0170.04020.38
7.0.00.0100.07020.08
5.6.280.0100.06720.91
5.6.210.0070.08320.62
5.6.200.0170.06718.19
5.6.190.0200.07720.61
5.6.180.4070.04320.57
5.6.170.0230.08020.52
5.6.160.0130.05720.50
5.6.150.0130.07018.13
5.6.140.0100.07718.21
5.6.130.0030.05318.25
5.6.120.0100.05020.91
5.6.110.0100.07721.16
5.6.100.0070.07721.00
5.6.90.0000.06020.98
5.6.80.0100.05020.50
5.6.70.0200.07720.51
5.5.350.0000.09020.49
5.5.340.0130.07017.98
5.5.330.0070.05020.40
5.5.320.0230.08020.28
5.5.310.0400.04020.31
5.5.300.0100.08318.06
5.5.290.0030.08317.97
5.5.280.0000.09020.75
5.5.270.0070.06020.88
5.5.260.0200.05320.85
5.5.250.0070.05320.61
5.5.240.0130.07020.08
5.4.450.0600.05019.61
5.4.440.0900.05319.57
5.4.430.0100.05719.56
5.4.420.0130.06019.42
5.4.410.0030.06019.35
5.4.400.0000.06018.89
5.4.390.0130.05018.57
5.4.380.0270.05718.86
5.4.370.0130.05718.59
5.4.360.0100.05718.60
5.4.350.0170.05318.73
5.4.340.0300.03718.63
5.4.320.0060.03512.51
5.4.310.0060.04212.51
5.4.300.0060.03812.51
5.4.290.0050.03812.50
5.4.280.0070.03512.41
5.4.270.0070.05718.96
5.4.260.0130.06719.09
5.4.250.0130.04718.98
5.4.240.0130.06319.02
5.4.230.0070.05719.00
5.4.220.0230.05018.95
5.4.210.0000.06718.83
5.4.200.0170.05319.00
5.4.190.0230.06018.79
5.4.180.0100.07018.83
5.4.170.0200.06318.64
5.4.160.0170.06718.75
5.4.150.0130.07718.82
5.4.140.0130.07016.50
5.4.130.0130.04316.38
5.4.120.0170.05016.54
5.4.110.0130.04716.56
5.4.100.0000.06716.51
5.4.90.0030.06316.51
5.4.80.0100.05016.60
5.4.70.0130.04316.39
5.4.60.0030.07716.31
5.4.50.0130.04716.53
5.4.40.0100.05016.43
5.4.30.0070.06716.37
5.4.20.0230.06016.48
5.4.10.0070.08316.35
5.4.00.0330.05715.98
5.3.290.0040.04012.80
5.3.280.0070.05314.69
5.3.270.0070.06014.70
5.3.260.0200.05714.81
5.3.250.0200.04714.63
5.3.240.0100.06014.60
5.3.230.0170.06014.69
5.3.220.0070.06014.64
5.3.210.0070.07314.59
5.3.200.0100.07714.66
5.3.190.0100.05714.71
5.3.180.0100.05314.75
5.3.170.0100.07314.76
5.3.160.0030.06314.75
5.3.150.0000.06314.65
5.3.140.0100.07714.70
5.3.130.0070.06014.59
5.3.120.0130.04314.64
5.3.110.0130.07714.64
5.3.100.0130.07314.13
5.3.90.0070.05314.25
5.3.80.0100.05014.00
5.3.70.0170.06014.09
5.3.60.0130.05313.99
5.3.50.0030.06014.05
5.3.40.0170.05314.05
5.3.30.0170.06013.90
5.3.20.0100.06313.55
5.3.10.0100.04713.73
5.3.00.0000.06313.48
5.2.170.0130.04711.06
5.2.160.0030.06311.13
5.2.150.0030.04711.06
5.2.140.0100.05711.24
5.2.130.0030.04311.08
5.2.120.0100.05711.18
5.2.110.0070.05311.20
5.2.100.0030.04011.29
5.2.90.0100.05311.20
5.2.80.0070.04711.06
5.2.70.0100.05011.19
5.2.60.0030.05711.29
5.2.50.0170.05011.12
5.2.40.0100.04011.24
5.2.30.0100.04711.00
5.2.20.0070.04010.93
5.2.10.0070.05710.95
5.2.00.0070.04310.73
5.1.60.0070.04710.25
5.1.50.0030.03710.23
5.1.40.0030.03710.19
5.1.30.0070.04310.34
5.1.20.0000.05010.35
5.1.10.0030.04010.15
5.1.00.0100.0479.92
5.0.50.0070.0278.40
5.0.40.0070.0338.50
5.0.30.0130.0508.40
5.0.20.0070.0378.41
5.0.10.0070.0378.23
5.0.00.0170.0408.14
4.4.90.0030.0275.84
4.4.80.0070.0205.80
4.4.70.0130.0235.74
4.4.60.0100.0275.91
4.4.50.0000.0235.81
4.4.40.0100.0335.81
4.4.30.0030.0305.93
4.4.20.0000.0335.91
4.4.10.0030.0305.89
4.4.00.0030.0435.86
4.3.110.0000.0275.90
4.3.100.0030.0205.79
4.3.90.0070.0235.71
4.3.80.0000.0335.81
4.3.70.0030.0275.72
4.3.60.0000.0335.72
4.3.50.0000.0235.79
4.3.40.0100.0275.79
4.3.30.0030.0205.43
4.3.20.0030.0275.43
4.3.10.0030.0235.43
4.3.00.0070.0277.38

preferences:
45.82 ms | 401 KiB | 5 Q