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, 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.0120.00618.31
8.3.50.0110.00522.01
8.3.40.0110.00318.71
8.3.30.0100.00319.04
8.3.20.0040.00420.32
8.3.10.0080.00022.09
8.3.00.0080.00022.44
8.2.180.0110.00817.00
8.2.170.0140.00022.96
8.2.160.0000.01419.03
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00726.16
8.2.120.0050.00319.23
8.2.110.0050.00522.20
8.2.100.0040.00817.78
8.2.90.0090.00017.63
8.2.80.0050.00317.97
8.2.70.0080.00017.93
8.2.60.0030.00617.93
8.2.50.0040.00418.16
8.2.40.0060.00320.47
8.2.30.0060.00618.19
8.2.20.0000.00717.65
8.2.10.0080.00019.48
8.2.00.0060.00317.75
8.1.280.0140.00325.92
8.1.270.0040.00422.01
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00322.58
8.1.230.0070.00419.23
8.1.220.0040.00417.77
8.1.210.0030.00518.77
8.1.200.0050.00517.38
8.1.190.0040.00417.36
8.1.180.0060.00318.10
8.1.170.0000.00818.62
8.1.160.0040.00422.04
8.1.150.0000.00718.52
8.1.140.0040.00417.50
8.1.130.0040.00417.84
8.1.120.0070.00017.34
8.1.110.0030.00617.51
8.1.100.0000.00717.34
8.1.90.0040.00417.36
8.1.80.0040.00417.35
8.1.70.0040.00417.40
8.1.60.0040.00417.65
8.1.50.0000.00817.45
8.1.40.0040.00417.43
8.1.30.0000.00717.60
8.1.20.0000.00817.70
8.1.10.0000.00717.56
8.1.00.0080.00017.46
8.0.300.0040.00419.63
8.0.290.0100.00316.58
8.0.280.0000.00718.33
8.0.270.0070.00017.27
8.0.260.0070.00016.70
8.0.250.0040.00416.88
8.0.240.0050.00216.88
8.0.230.0030.00316.90
8.0.220.0000.00716.78
8.0.210.0030.00316.83
8.0.200.0050.00216.95
8.0.190.0000.00716.86
8.0.180.0000.00716.88
8.0.170.0000.00816.92
8.0.160.0000.00716.82
8.0.150.0040.00416.77
8.0.140.0050.00216.75
8.0.130.0000.00613.37
8.0.120.0040.00416.77
8.0.110.0040.00416.78
8.0.100.0040.00416.93
8.0.90.0070.00016.89
8.0.80.0070.01016.82
8.0.70.0070.00016.94
8.0.60.0050.00316.96
8.0.50.0000.00716.95
8.0.30.0130.00917.07
8.0.20.0100.00717.40
8.0.10.0000.00817.06
8.0.00.0110.00916.87
7.4.330.0000.00715.00
7.4.320.0030.00316.51
7.4.300.0030.00316.57
7.4.290.0070.00016.42
7.4.280.0030.00316.46
7.4.270.0030.00316.56
7.4.260.0070.00016.59
7.4.250.0070.00016.38
7.4.240.0020.00616.54
7.4.230.0000.00716.64
7.4.220.0180.00716.66
7.4.210.0060.01016.59
7.4.200.0070.00016.73
7.4.190.0070.00016.58
7.4.160.0100.01016.68
7.4.150.0070.01117.40
7.4.140.0100.01017.86
7.4.130.0100.00816.48
7.4.120.0110.00616.50
7.4.110.0140.00416.57
7.4.100.0030.01416.54
7.4.90.0060.01216.49
7.4.80.0200.00619.39
7.4.70.0100.00716.62
7.4.60.0030.01316.53
7.4.50.0030.00716.48
7.4.40.0100.00722.77
7.4.30.0090.00616.48
7.4.00.0070.01114.74
7.3.330.0000.00513.35
7.3.320.0060.00013.30
7.3.310.0020.00516.19
7.3.300.0000.00716.35
7.3.290.0110.00316.38
7.3.280.0090.00916.37
7.3.270.0090.01017.40
7.3.260.0030.01416.61
7.3.250.0130.00716.48
7.3.240.0060.01116.55
7.3.230.0060.01016.43
7.3.210.0070.01016.34
7.3.200.0030.01419.39
7.3.190.0030.01416.39
7.3.180.0090.00616.71
7.3.170.0170.00016.60
7.3.160.0060.01016.61
7.3.120.0060.01014.79
7.2.330.0090.01616.70
7.2.320.0160.00316.80
7.2.310.0090.00916.58
7.2.300.0120.01216.49
7.2.290.0080.00916.66
7.2.60.0000.01416.79
7.2.00.0040.01119.56
7.1.200.0000.01015.93
7.1.100.0060.01018.24
7.1.70.0000.00717.18
7.1.60.0110.01419.82
7.1.50.0070.00716.96
7.1.00.0000.08022.25
7.0.200.0030.00916.47
7.0.140.0000.07722.19
7.0.60.0100.06719.90
7.0.50.0030.07717.73
7.0.40.0070.05020.24
7.0.30.0370.07020.14
7.0.20.0270.04020.20
7.0.10.0100.04020.06
7.0.00.0070.07720.21
5.6.280.0130.06321.13
5.6.210.0070.05020.70
5.6.200.0200.07318.30
5.6.190.0030.04320.57
5.6.180.0230.08320.63
5.6.170.0270.04020.51
5.6.160.0030.04320.62
5.6.150.0030.08318.17
5.6.140.0070.08018.15
5.6.130.0030.08018.22
5.6.120.0070.03720.99
5.6.110.0000.04320.99
5.6.100.0170.07021.13
5.6.90.0100.07721.01
5.6.80.0100.06320.42
5.5.350.0000.03320.45
5.5.340.0130.07017.95
5.5.330.0070.09320.25
5.5.320.0400.06320.20
5.5.310.0270.06320.43
5.5.300.0070.08318.04
5.5.290.0030.07718.04
5.5.280.0030.04320.70
5.5.270.0030.09020.77
5.5.260.0070.05020.78
5.5.250.0070.08320.79
5.5.240.0300.07320.18
5.4.450.0500.05719.46
5.4.440.0800.06719.57
5.4.430.0670.05719.16
5.4.420.0830.06019.42
5.4.410.1070.08019.47
5.4.400.0500.07019.11
5.4.390.0800.05018.84
5.4.380.0300.05318.61
5.4.370.0200.05018.51
5.4.360.0200.04718.63
5.4.350.0170.05318.48
5.4.340.0200.05318.85
5.4.320.0070.03712.51
5.4.310.0080.04112.50
5.4.300.0060.05012.51
5.4.290.0070.04012.51
5.4.280.0050.03712.41
5.4.270.0200.06018.92
5.4.260.0100.05718.85
5.4.250.0200.05718.91
5.4.240.0200.05318.71
5.4.230.0200.06018.94
5.4.220.0300.06018.71
5.4.210.0170.05318.91
5.4.200.0070.05718.96
5.4.190.0130.05718.75
5.4.180.0170.06018.95
5.4.170.0100.07018.90
5.4.160.0170.04718.72
5.4.150.0130.06718.83
5.4.140.0100.06316.38
5.4.130.0100.07016.35
5.4.120.0170.05016.40
5.4.110.0230.05716.31
5.4.100.0170.05316.46
5.4.90.0170.04016.52
5.4.80.0200.05716.50
5.4.70.0130.04716.39
5.4.60.0100.05716.34
5.4.50.0170.04316.41
5.4.40.0100.05016.46
5.4.30.0100.05016.41
5.4.20.0030.07016.47
5.4.10.0100.07316.30
5.4.00.0200.07015.89
5.3.290.0090.04012.80
5.3.280.0100.06014.70
5.3.270.0130.06314.80
5.3.260.0130.07014.70
5.3.250.0100.07714.68
5.3.240.0270.05714.61
5.3.230.0200.06014.70
5.3.220.0100.05314.74
5.3.210.0100.05714.71
5.3.200.0130.04714.78
5.3.190.0170.06014.55
5.3.180.0130.06014.75
5.3.170.0170.05014.66
5.3.160.0130.06314.40
5.3.150.0200.05714.55
5.3.140.0130.05314.65
5.3.130.0170.06714.46
5.3.120.0030.06714.55
5.3.110.0200.06314.72
5.3.100.0100.07013.90
5.3.90.0200.06314.05
5.3.80.0130.05714.11
5.3.70.0130.05314.01
5.3.60.0100.05314.23
5.3.50.0130.05013.93
5.3.40.0130.05713.96
5.3.30.0100.06713.92
5.3.20.0200.04713.69
5.3.10.0100.05013.74
5.3.00.0170.05713.74
5.2.170.0200.03711.11
5.2.160.0170.05011.16
5.2.150.0070.05311.34
5.2.140.0170.05011.14
5.2.130.0070.04711.07
5.2.120.0100.03711.18
5.2.110.0070.05311.18
5.2.100.0030.06311.17
5.2.90.0130.04311.18
5.2.80.0030.06010.94
5.2.70.0130.04011.19
5.2.60.0070.05311.06
5.2.50.0070.05311.25
5.2.40.0070.05311.09
5.2.30.0070.05711.16
5.2.20.0030.06011.19
5.2.10.0030.05311.05
5.2.00.0170.04710.96
5.1.60.0000.05010.17
5.1.50.0130.03710.02
5.1.40.0070.04710.08
5.1.30.0130.04310.25
5.1.20.0030.04710.36
5.1.10.0030.03710.16
5.1.00.0070.05010.23
5.0.50.0030.0408.62
5.0.40.0000.0438.38
5.0.30.0030.0538.36
5.0.20.0070.0308.36
5.0.10.0070.0278.36
5.0.00.0000.0578.36
4.4.90.0000.0238.36
4.4.80.0130.0308.36
4.4.70.0070.0238.36
4.4.60.0030.0238.36
4.4.50.0030.0238.36
4.4.40.0070.0408.36
4.4.30.0170.0178.35
4.4.20.0030.0338.36
4.4.10.0100.0238.36
4.4.00.0070.0338.36
4.3.110.0070.0208.36
4.3.100.0070.0238.36
4.3.90.0030.0308.36
4.3.80.0070.0438.36
4.3.70.0000.0278.36
4.3.60.0000.0308.36
4.3.50.0000.0338.36
4.3.40.0000.0378.36
4.3.30.0030.0308.36
4.3.20.0030.0278.36
4.3.10.0030.0308.36
4.3.00.0100.0208.13

preferences:
46.11 ms | 401 KiB | 5 Q