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 >> $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) & 0xff; $right = (ord($input[$i + $skip + 1]) & $mask) >> (8 - $offset); printf("%08b %08b\n", $left, $right); $output[$i] = chr(($left | $right) & 0xff); } } //0b000100010001000100000000; $input = "abc\x00"; $bits = 32; string_shift_left($input, strlen($input) - 1, $bits, $output); for ($i = 0; $i < strlen($input); $i++) { printf("\n%02x: %08b", ord($input[$i]), ord($input[$i])); } 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.0070.01118.18
8.3.50.0050.01121.89
8.3.40.0150.00018.83
8.3.30.0070.00719.07
8.3.20.0050.00520.37
8.3.10.0080.00022.05
8.3.00.0000.00722.43
8.2.180.0070.01416.35
8.2.170.0070.01122.96
8.2.160.0070.00719.19
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0000.00817.63
8.2.110.0070.00322.26
8.2.100.0040.00818.22
8.2.90.0080.00019.22
8.2.80.0030.00618.05
8.2.70.0060.00317.63
8.2.60.0040.00817.66
8.2.50.0000.00818.07
8.2.40.0080.00017.97
8.2.30.0030.00918.20
8.2.20.0000.00717.75
8.2.10.0040.00417.70
8.2.00.0030.00617.73
8.1.280.0100.00725.92
8.1.270.0050.00322.14
8.1.260.0040.00426.35
8.1.250.0000.00928.09
8.1.240.0100.00023.91
8.1.230.0120.00019.04
8.1.220.0030.00917.78
8.1.210.0040.00418.77
8.1.200.0090.00017.48
8.1.190.0060.00317.39
8.1.180.0050.00318.10
8.1.170.0000.00818.66
8.1.160.0000.00722.14
8.1.150.0040.00418.66
8.1.140.0050.00217.46
8.1.130.0070.00017.83
8.1.120.0040.00417.40
8.1.110.0080.00017.48
8.1.100.0050.00217.53
8.1.90.0040.00417.46
8.1.80.0030.00517.48
8.1.70.0000.00717.45
8.1.60.0000.00817.53
8.1.50.0000.00817.54
8.1.40.0080.00017.42
8.1.30.0020.00517.54
8.1.20.0030.00717.51
8.1.10.0000.00717.49
8.1.00.0000.00717.59
8.0.300.0000.00818.77
8.0.290.0000.00717.16
8.0.280.0000.00718.38
8.0.270.0000.00717.32
8.0.260.0000.00616.86
8.0.250.0050.00316.99
8.0.240.0000.00716.86
8.0.230.0030.00316.98
8.0.220.0070.00016.95
8.0.210.0030.00316.92
8.0.200.0060.00016.89
8.0.190.0040.00416.94
8.0.180.0000.00716.95
8.0.170.0040.00416.95
8.0.160.0000.00816.95
8.0.150.0040.00416.86
8.0.140.0040.00416.85
8.0.130.0030.00313.40
8.0.120.0030.00516.82
8.0.110.0000.00816.83
8.0.100.0070.00016.95
8.0.90.0030.00516.79
8.0.80.0090.00616.91
8.0.70.0000.00716.86
8.0.60.0040.00416.93
8.0.50.0040.00416.95
8.0.30.0130.00717.02
8.0.20.0110.00917.40
8.0.10.0030.00617.07
8.0.00.0090.01016.75
7.4.330.0070.00015.00
7.4.320.0060.00016.49
7.4.300.0030.00316.52
7.4.290.0040.00416.48
7.4.280.0030.00316.61
7.4.270.0030.00316.51
7.4.260.0080.00016.63
7.4.250.0040.00416.54
7.4.240.0020.00616.47
7.4.230.0000.00716.67
7.4.220.0100.00716.58
7.4.210.0080.00816.56
7.4.200.0000.00716.37
7.4.190.0030.00316.48
7.4.160.0060.01016.62
7.4.150.0040.01417.40
7.4.140.0030.01417.86
7.4.130.0090.00916.38
7.4.120.0110.00816.49
7.4.110.0110.00716.52
7.4.100.0080.00816.46
7.4.90.0030.01516.50
7.4.80.0130.01019.39
7.4.70.0090.00916.68
7.4.60.0060.01216.61
7.4.50.0040.00416.52
7.4.40.0000.01422.77
7.4.30.0090.00616.64
7.4.10.0070.01016.55
7.4.00.0070.01115.38
7.3.330.0000.00513.33
7.3.320.0000.00513.32
7.3.310.0030.00316.36
7.3.300.0030.00316.37
7.3.290.0130.00716.28
7.3.280.0100.00716.31
7.3.270.0070.01017.40
7.3.260.0070.01016.22
7.3.250.0180.00816.55
7.3.240.0070.01116.44
7.3.230.0030.01316.39
7.3.210.0100.00716.62
7.3.200.0040.01319.39
7.3.190.0090.01216.23
7.3.180.0090.00616.32
7.3.170.0100.00516.38
7.3.160.0030.01416.51
7.3.130.0070.01016.27
7.3.120.0100.00715.47
7.3.110.0070.00915.63
7.3.100.0050.01115.71
7.3.90.0050.00915.48
7.3.80.0050.00915.74
7.3.70.0050.00915.78
7.3.60.0020.01315.59
7.3.50.0050.00815.61
7.3.40.0050.00715.60
7.3.30.0050.00915.55
7.3.20.0020.01017.44
7.3.10.0060.00617.44
7.3.00.0050.01117.23
7.2.330.0030.01416.54
7.2.320.0070.01116.84
7.2.310.0170.00316.79
7.2.300.0100.00616.80
7.2.290.0060.01216.75
7.2.260.0130.00716.58
7.2.250.0070.01015.76
7.2.240.0080.00815.95
7.2.230.0040.01115.85
7.2.220.0040.00915.98
7.2.210.0030.01015.80
7.2.200.0040.01115.97
7.2.190.0110.00315.95
7.2.180.0070.00715.95
7.2.170.0050.00715.65
7.2.160.0100.00716.59
7.2.150.0100.00718.21
7.2.140.0100.00318.28
7.2.130.0040.01118.54
7.2.120.0070.00718.45
7.2.110.0040.00818.42
7.2.100.0110.00318.39
7.2.90.0040.01518.39
7.2.80.0120.00318.45
7.2.70.0000.01818.45
7.2.60.0090.00717.73
7.2.50.0110.00617.77
7.2.40.0060.00918.54
7.2.30.0110.00418.42
7.2.20.0030.01018.51
7.2.10.0000.01218.36
7.2.00.0070.00718.36
7.1.330.0050.01016.60
7.1.320.0070.00716.63
7.1.310.0070.00616.51
7.1.300.0070.00716.60
7.1.290.0050.00916.50
7.1.280.0080.00516.67
7.1.270.0050.00416.54
7.1.260.0050.00816.54
7.1.250.0040.01117.32
7.1.240.0060.00617.30
7.1.230.0070.01017.28
7.1.220.0110.00417.36
7.1.210.0070.00717.26
7.1.200.0050.00716.63
7.1.190.0100.00317.49
7.1.180.0000.01317.48
7.1.170.0070.00317.17
7.1.160.0110.00417.43
7.1.150.0000.01917.27
7.1.140.0070.00417.30
7.1.130.0030.00717.28
7.1.120.0070.00417.21
7.1.110.0100.00017.32
7.1.100.0030.01317.32
7.1.90.0130.00617.17
7.1.80.0100.01017.27
7.1.70.0030.00717.11
7.1.60.0050.01418.52
7.1.50.0020.01717.18
7.1.40.0090.00617.46
7.1.30.0120.00017.34
7.1.20.0090.00617.43
7.1.10.0060.00617.27
7.1.00.0020.04619.74
7.0.330.0030.01016.94
7.0.320.0060.00616.97
7.0.310.0070.00717.13
7.0.300.0140.00016.98
7.0.290.0060.01317.02
7.0.280.0060.00616.93
7.0.270.0040.01117.06
7.0.260.0080.00417.18
7.0.250.0040.00816.93
7.0.240.0060.00617.02
7.0.230.0070.00717.13
7.0.220.0040.01116.90
7.0.210.0040.00817.02
7.0.200.0050.00616.04
7.0.190.0100.00317.16
7.0.180.0070.00317.12
7.0.170.0090.00617.18
7.0.160.0070.00716.98
7.0.150.0090.00616.97
7.0.140.0090.03619.51
7.0.130.0040.01416.99
7.0.120.0070.00316.92
7.0.110.0090.00617.02
7.0.100.0040.00816.94
7.0.90.0030.01017.04
7.0.80.0060.01017.18
7.0.70.0100.00316.94
7.0.60.0150.03418.49
7.0.50.0060.04917.46
7.0.40.0070.03917.66
7.0.30.0150.03817.54
7.0.20.0170.02017.56
7.0.10.0080.02717.66
7.0.00.0030.03217.53
5.6.400.0070.00715.75
5.6.390.0060.00616.12
5.6.380.0030.01215.63
5.6.370.0090.00615.71
5.6.360.0000.01015.91
5.6.350.0070.00715.97
5.6.340.0070.01115.62
5.6.330.0070.01015.86
5.6.320.0100.00716.04
5.6.310.0090.00316.03
5.6.300.0060.00916.07
5.6.290.0060.00616.08
5.6.280.0050.04218.37
5.6.270.0130.00016.02
5.6.260.0030.01215.87
5.6.250.0100.00715.96
5.6.240.0120.00315.99
5.6.230.0100.01015.81
5.6.220.0110.00316.17
5.6.210.0070.04318.31
5.6.200.0030.02917.21
5.6.190.0080.04018.43
5.6.180.1870.02918.26
5.6.170.0160.04118.17
5.6.160.0050.04718.15
5.6.150.0050.02517.05
5.6.140.0050.04217.12
5.6.130.0060.04117.15
5.6.120.0120.03718.42
5.6.110.0060.03418.42
5.6.100.0100.02518.39
5.6.90.0050.04218.47
5.6.80.0070.04118.13
5.6.70.0030.01415.70
5.6.60.0030.00916.00
5.6.50.0060.01215.67
5.6.40.0120.00015.93
5.6.30.0090.00315.86
5.6.20.0130.00315.86
5.6.10.0030.00915.85
5.6.00.0060.00615.69
5.5.380.0000.01115.79
5.5.370.0000.01315.88
5.5.360.0070.00315.93
5.5.350.0150.04218.18
5.5.340.0110.04017.00
5.5.330.0140.03518.12
5.5.320.0120.02518.12
5.5.310.0080.02718.17
5.5.300.0060.02317.04
5.5.290.0060.02117.04
5.5.280.0070.04718.34
5.5.270.0100.04318.40
5.5.260.0030.03118.33
5.5.250.0030.02618.23
5.5.240.0080.04918.07
5.5.230.0000.01515.88
5.5.220.0070.00415.89
5.5.210.0040.01515.84
5.5.200.0060.00915.67
5.5.190.0090.00315.92
5.5.180.0060.01015.90
5.5.170.0100.00615.84
5.5.160.0060.00815.98
5.5.150.0040.01215.63
5.5.140.0040.01115.79
5.5.130.0030.00915.92
5.5.120.0090.01015.72
5.5.110.0090.00615.90
5.5.100.0070.00715.84
5.5.90.0070.01115.90
5.5.80.0150.00315.74
5.5.70.0080.00815.93
5.5.60.0000.01415.80
5.5.50.0070.00716.03
5.5.40.0000.01115.91
5.5.30.0100.00315.68
5.5.20.0030.01015.74
5.5.10.0030.01415.74
5.5.00.0030.01215.64
5.4.450.0400.02816.16
5.4.440.0370.03716.16
5.4.430.0150.02316.08
5.4.420.0100.02716.10
5.4.410.0050.03216.02
5.4.400.0110.02515.67
5.4.390.0070.03015.56
5.4.380.0130.04815.63
5.4.370.0080.03815.76
5.4.360.0120.02815.60
5.4.350.0130.03215.66
5.4.340.0140.03215.59
5.4.330.0000.01412.79
5.4.320.0060.02312.55
5.4.310.0030.02412.72
5.4.300.0050.02512.62
5.4.290.0070.02412.59
5.4.280.0030.02312.46
5.4.270.0080.03215.64
5.4.260.0030.03315.75
5.4.250.0080.02815.72
5.4.240.0080.03615.62
5.4.230.0050.03215.60
5.4.220.0050.03815.68
5.4.210.0070.03515.90
5.4.200.0150.03015.89
5.4.190.0080.02615.69
5.4.180.0080.03415.78
5.4.170.0090.03515.65
5.4.160.0030.03215.80
5.4.150.0050.04615.70
5.4.140.0080.03214.59
5.4.130.0040.02914.64
5.4.120.0100.02514.54
5.4.110.0020.03714.53
5.4.100.0070.04014.59
5.4.90.0100.03714.65
5.4.80.0110.03314.53
5.4.70.0050.04314.67
5.4.60.0100.03714.49
5.4.50.0100.02614.53
5.4.40.0050.04014.64
5.4.30.0030.03214.64
5.4.20.0050.03614.49
5.4.10.0050.02914.58
5.4.00.0070.03014.19
5.3.290.0020.02512.96
5.3.280.0040.03013.92
5.3.270.0070.03913.82
5.3.260.0070.04513.70
5.3.250.0130.03413.84
5.3.240.0030.03113.87
5.3.230.0030.04413.93
5.3.220.0070.03613.95
5.3.210.0070.03313.80
5.3.200.0100.03613.86
5.3.190.0040.03213.90
5.3.180.0080.03213.93
5.3.170.0080.03813.87
5.3.160.0050.04214.00
5.3.150.0050.03113.91
5.3.140.0060.03813.83
5.3.130.0070.04413.81
5.3.120.0100.02713.87
5.3.110.0080.03613.78
5.3.100.0080.03113.60
5.3.90.0120.02713.66
5.3.80.0080.03113.50
5.3.70.0120.02713.49
5.3.60.0080.03713.55
5.3.50.0070.03313.54
5.3.40.0080.03513.48
5.3.30.0050.03213.63
5.3.20.0070.04013.28
5.3.10.0050.02913.25
5.3.00.0050.03213.32
5.2.170.0030.04711.23
5.2.160.0070.04711.16
5.2.150.0100.04011.13
5.2.140.0100.05011.14
5.2.130.0000.05311.19
5.2.120.0070.03711.10
5.2.110.0070.04011.27
5.2.100.0100.03711.02
5.2.90.0130.05011.29
5.2.80.0070.04311.11
5.2.70.0100.06011.19
5.2.60.0100.03711.14
5.2.50.0070.05710.99
5.2.40.0070.04010.92
5.2.30.0000.06010.89
5.2.20.0100.04711.06
5.2.10.0230.02710.86
5.2.00.0030.04310.57
5.1.60.0030.0339.97
5.1.50.0070.04010.25
5.1.40.0030.03710.05
5.1.30.0100.03310.42
5.1.20.0030.04010.34
5.1.10.0070.04710.09
5.1.00.0070.05310.18
5.0.50.0030.0338.56
5.0.40.0100.0378.36
5.0.30.0070.0408.25
5.0.20.0100.0338.32
5.0.10.0070.0378.24
5.0.00.0100.0478.17
4.4.90.0070.0205.77
4.4.80.0070.0205.82
4.4.70.0000.0275.86
4.4.60.0100.0235.84
4.4.50.0070.0205.86
4.4.40.0030.0335.83
4.4.30.0070.0275.84
4.4.20.0070.0175.95
4.4.10.0070.0275.89
4.4.00.0100.0405.86
4.3.110.0030.0305.84
4.3.100.0000.0235.80
4.3.90.0030.0305.75
4.3.80.0030.0335.87
4.3.70.0030.0205.67
4.3.60.0000.0275.78
4.3.50.0000.0275.73
4.3.40.0000.0475.67
4.3.30.0000.0275.59
4.3.20.0030.0235.59
4.3.10.0030.0175.59
4.3.00.0100.0237.38

preferences:
78.45 ms | 400 KiB | 5 Q