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; $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++) { $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.70.0090.00916.47
8.3.60.0070.01318.31
8.3.50.0050.01022.03
8.3.40.0040.01118.64
8.3.30.0070.00719.04
8.3.20.0000.00820.21
8.3.10.0040.00422.08
8.3.00.0080.00022.39
8.2.190.0110.00716.58
8.2.180.0070.01116.88
8.2.170.0000.01422.96
8.2.160.0070.00719.34
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0050.00226.16
8.2.120.0040.00419.25
8.2.110.0080.00321.13
8.2.100.0140.00317.83
8.2.90.0000.00819.30
8.2.80.0030.00518.16
8.2.70.0030.00517.63
8.2.60.0000.00817.93
8.2.50.0030.00618.10
8.2.40.0040.00418.22
8.2.30.0040.00818.19
8.2.20.0040.00417.73
8.2.10.0030.00519.58
8.2.00.0030.00617.80
8.1.280.0170.00025.92
8.1.270.0080.00022.18
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0040.00422.23
8.1.230.0070.00417.89
8.1.220.0080.00017.76
8.1.210.0000.00818.77
8.1.200.0100.00017.35
8.1.190.0030.00517.35
8.1.180.0030.00518.10
8.1.170.0080.00018.64
8.1.160.0030.00622.07
8.1.150.0000.00818.68
8.1.140.0040.00417.46
8.1.130.0070.00017.86
8.1.120.0000.00717.45
8.1.110.0050.00317.36
8.1.100.0050.00317.46
8.1.90.0040.00417.45
8.1.80.0070.00017.51
8.1.70.0000.00717.43
8.1.60.0030.00617.49
8.1.50.0000.00817.53
8.1.40.0000.00817.57
8.1.30.0000.00817.59
8.1.20.0000.00817.67
8.1.10.0000.00717.48
8.1.00.0040.00417.41
8.0.300.0040.00418.77
8.0.290.0000.00716.63
8.0.280.0070.00018.41
8.0.270.0070.00017.31
8.0.260.0000.00716.75
8.0.250.0070.00016.96
8.0.240.0000.00716.88
8.0.230.0030.00316.97
8.0.220.0040.00416.84
8.0.210.0030.00316.79
8.0.200.0030.00316.82
8.0.190.0070.00016.84
8.0.180.0050.00216.94
8.0.170.0000.00816.96
8.0.160.0000.00816.96
8.0.150.0070.00016.80
8.0.140.0050.00216.88
8.0.130.0000.00613.28
8.0.120.0040.00416.94
8.0.110.0000.00716.83
8.0.100.0070.00016.85
8.0.90.0000.00716.90
8.0.80.0110.00516.84
8.0.70.0000.00716.89
8.0.60.0070.00016.79
8.0.50.0040.00416.79
8.0.30.0110.00917.11
8.0.20.0110.00917.42
8.0.10.0000.00716.81
8.0.00.0130.00516.63
7.4.330.0070.00015.00
7.4.320.0000.00616.57
7.4.300.0030.00316.64
7.4.290.0000.00716.50
7.4.280.0030.00316.40
7.4.270.0040.00416.54
7.4.260.0030.00316.54
7.4.250.0060.00316.60
7.4.240.0030.00416.48
7.4.230.0000.00716.63
7.4.220.0090.00916.64
7.4.210.0070.00716.57
7.4.200.0030.00316.39
7.4.190.0000.00816.65
7.4.160.0030.01316.55
7.4.150.0030.01417.40
7.4.140.0140.00517.86
7.4.130.0110.00916.62
7.4.120.0110.00716.47
7.4.110.0070.01016.56
7.4.100.0070.01016.51
7.4.90.0060.01216.61
7.4.80.0160.00619.39
7.4.70.0060.00916.57
7.4.60.0050.01116.46
7.4.50.0000.00816.35
7.4.40.0070.00722.77
7.4.30.0080.00816.55
7.4.00.0070.01015.05
7.3.330.0020.00213.32
7.3.320.0060.00013.19
7.3.310.0030.00316.37
7.3.300.0050.00216.25
7.3.290.0040.01116.29
7.3.280.0060.01116.35
7.3.270.0140.00717.40
7.3.260.0210.00316.39
7.3.250.0100.00816.46
7.3.240.0150.00616.41
7.3.230.0110.00616.60
7.3.210.0090.00916.38
7.3.200.0030.01319.39
7.3.190.0090.00916.60
7.3.180.0040.01216.65
7.3.170.0090.00616.36
7.3.160.0110.00716.67
7.3.120.0000.01514.81
7.2.330.0140.00616.58
7.2.320.0090.00916.86
7.2.310.0090.01216.82
7.2.300.0120.00916.79
7.2.290.0100.01016.56
7.2.00.0040.01119.59
7.1.100.0040.00818.09
7.1.70.0030.00617.04
7.1.60.0090.01519.82
7.1.50.0090.00616.99
7.1.00.0130.06722.41
7.0.200.0080.00416.64
7.0.140.0000.07721.95
7.0.60.0130.06019.96
7.0.50.0000.05317.75
7.0.40.0070.07320.18
7.0.30.0370.07720.10
7.0.20.0170.05720.20
7.0.10.0270.07720.10
7.0.00.0030.05020.30
5.6.280.0070.06721.14
5.6.210.0100.07720.71
5.6.200.0070.08018.19
5.6.190.0030.04720.63
5.6.180.4130.04320.39
5.6.170.0270.04320.62
5.6.160.0330.06320.56
5.6.150.0100.05718.18
5.6.140.0100.04318.20
5.6.130.0070.04018.18
5.6.120.0070.08021.16
5.6.110.0000.09021.15
5.6.100.0030.04721.00
5.6.90.0130.08021.12
5.6.80.0170.06720.39
5.6.70.0300.07720.36
5.5.350.0030.08020.42
5.5.340.0000.08017.98
5.5.330.0100.07320.27
5.5.320.0270.03720.35
5.5.310.0130.04320.37
5.5.300.0070.03718.01
5.5.290.0130.07318.01
5.5.280.0000.08720.78
5.5.270.0030.05720.88
5.5.260.0070.06320.67
5.5.250.0130.06020.70
5.5.240.0100.07020.38
5.4.450.0400.06719.31
5.4.440.0370.05719.27
5.4.430.0330.05319.20
5.4.420.0370.04019.17
5.4.410.0330.07719.11
5.4.400.0470.06019.10
5.4.390.0200.07719.09
5.4.380.0230.06018.87
5.4.370.0400.04018.87
5.4.360.0230.05319.08
5.4.350.0300.07019.17
5.4.340.0300.06718.95
5.4.320.0600.03319.20
5.4.310.0330.04319.10
5.4.300.0230.03719.31
5.4.290.0230.04719.15
5.4.280.0270.03319.21
5.4.270.0300.03319.19
5.4.260.0230.03719.16
5.4.250.0270.03318.94
5.4.240.0230.05719.07
5.4.230.0230.04019.15
5.4.220.0330.03019.14
5.4.210.0300.03318.98
5.4.200.0230.04018.85
5.4.190.0300.03318.95
5.4.180.0300.03719.15
5.4.170.0200.04319.21
5.4.160.0330.03719.12
5.4.150.0230.04018.96
5.4.140.0300.04716.50
5.4.130.0300.03016.35
5.4.120.0230.03716.52
5.4.110.0300.03016.51
5.4.100.0270.03316.45
5.4.90.0330.02716.60
5.4.80.0400.06316.36
5.4.70.0370.06016.52
5.4.60.0330.04716.32
5.4.50.0270.03716.34
5.4.40.0300.03316.52
5.4.30.0230.04016.25
5.4.20.0300.04716.16
5.4.10.0430.06016.24
5.4.00.0330.03716.12
5.3.290.0330.03314.90
5.3.280.0270.03714.53
5.3.270.0370.03314.52
5.3.260.0230.04714.61
5.3.250.0270.04714.63
5.3.240.0330.03014.62
5.3.230.0230.04014.68
5.3.220.0370.05014.50
5.3.210.0370.04014.55
5.3.200.0230.04014.62
5.3.190.0370.02714.69
5.3.180.0370.03714.73
5.3.170.0330.03314.47
5.3.160.0430.06314.69
5.3.150.0330.04014.58
5.3.140.0270.03714.48
5.3.130.0400.06714.64
5.3.120.0330.04014.61
5.3.110.0500.05714.56
5.3.100.0330.08013.95
5.3.90.0400.03714.14
5.3.80.0400.07014.20
5.3.70.0370.06014.00
5.3.60.0470.06014.13
5.3.50.0430.06314.08
5.3.40.0370.03713.90
5.3.30.0370.06314.00
5.3.20.0500.05013.61
5.3.10.0300.04713.69
5.3.00.0430.04713.87
5.2.170.0300.05711.18
5.2.160.0230.04311.18
5.2.150.0370.03311.18
5.2.140.0500.04311.18
5.2.130.0330.05011.23
5.2.120.0430.04711.19
5.2.110.0400.03311.18
5.2.100.0330.03711.20
5.2.90.0330.04711.18
5.2.80.0300.03011.33
5.2.70.0270.05711.33
5.2.60.0300.04011.22
5.2.50.0370.04311.18
5.2.40.0270.03311.18
5.2.30.0230.06011.18
5.2.20.0300.05011.18
5.2.10.0270.02311.18
5.2.00.0230.03011.18
5.1.60.0300.04311.18
5.1.50.0300.05011.18
5.1.40.0230.04311.18
5.1.30.0270.05311.18
5.1.20.0200.03311.18
5.1.10.0170.03011.18
5.1.00.0200.02711.18
5.0.50.0100.02011.18
5.0.40.0070.02311.18
5.0.30.0100.03711.18
5.0.20.0170.03011.18
5.0.10.0130.02011.18
5.0.00.0070.03311.18
4.4.90.0070.02711.18
4.4.80.0100.02011.18
4.4.70.0100.02311.18
4.4.60.0070.02011.18
4.4.50.0130.01711.18
4.4.40.0170.04311.18
4.4.30.0130.02711.18
4.4.20.0100.02311.18
4.4.10.0130.01311.18
4.4.00.0070.02711.18
4.3.110.0170.01311.18
4.3.100.0070.01711.18
4.3.90.0100.01711.18
4.3.80.0070.02711.18
4.3.70.0200.02311.18
4.3.60.0100.02711.18
4.3.50.0100.03011.18
4.3.40.0100.04011.18
4.3.30.0030.01711.18
4.3.20.0070.02711.18
4.3.10.0100.03311.18
4.3.00.0070.03311.18

preferences:
51.29 ms | 401 KiB | 5 Q