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 = 8 - ($bits % 8); $mask = 0xff >> $offset; var_dump($skip, $copylen, $offset, $mask); $output = str_pad('', $inputlen + 1, "\x00"); if ($offset == 8) { /* 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", 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.60.0170.00318.31
8.3.50.0000.01418.16
8.3.40.0090.00618.82
8.3.30.0090.00619.09
8.3.20.0000.00820.31
8.3.10.0040.00421.92
8.3.00.0000.00822.52
8.2.180.0150.00316.75
8.2.170.0070.00722.96
8.2.160.0070.00719.33
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0050.00319.48
8.2.110.0190.00322.29
8.2.100.0040.00817.84
8.2.90.0040.00418.16
8.2.80.0000.00817.97
8.2.70.0000.00817.61
8.2.60.0060.00317.93
8.2.50.0070.00718.07
8.2.40.0080.00018.34
8.2.30.0070.00418.17
8.2.20.0070.00017.74
8.2.10.0040.00419.54
8.2.00.0000.00717.87
8.1.270.0080.00022.17
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0100.01022.57
8.1.230.0070.00320.79
8.1.220.0040.00417.74
8.1.210.0050.00318.97
8.1.200.0080.00317.47
8.1.190.0030.00517.29
8.1.180.0000.00818.10
8.1.170.0060.00318.44
8.1.160.0000.00721.96
8.1.150.0000.00818.52
8.1.140.0030.00617.46
8.1.130.0060.00317.85
8.1.120.0000.00717.38
8.1.110.0030.00517.38
8.1.100.0040.00417.46
8.1.90.0000.00717.41
8.1.80.0050.00217.54
8.1.70.0000.00717.50
8.1.60.0000.00817.55
8.1.50.0030.00517.60
8.1.40.0000.00717.53
8.1.30.0000.00717.59
8.1.20.0000.00917.55
8.1.10.0040.00417.52
8.1.00.0000.00817.38
8.0.300.0040.00419.94
8.0.290.0030.00317.05
8.0.280.0080.00018.39
8.0.270.0030.00317.14
8.0.260.0030.00316.81
8.0.250.0030.00317.04
8.0.240.0040.00417.02
8.0.230.0070.00016.95
8.0.220.0000.00716.97
8.0.210.0030.00316.96
8.0.200.0080.00016.93
8.0.190.0040.00416.90
8.0.180.0070.00016.99
8.0.170.0040.00417.05
8.0.160.0050.00217.09
8.0.150.0040.00416.85
8.0.140.0060.00316.89
8.0.130.0000.00513.32
8.0.120.0000.00816.89
8.0.110.0070.00016.87
8.0.100.0040.00416.91
8.0.90.0000.00716.85
8.0.80.0090.00616.84
8.0.70.0000.00717.00
8.0.60.0080.00017.03
8.0.50.0070.00016.84
8.0.30.0110.00817.02
8.0.20.0070.01417.40
8.0.10.0040.00416.95
8.0.00.0150.00716.67
7.4.330.0050.00215.00
7.4.320.0000.00716.50
7.4.300.0000.00616.50
7.4.290.0000.00716.48
7.4.280.0000.00816.61
7.4.270.0030.00516.50
7.4.260.0070.00016.61
7.4.250.0050.00316.58
7.4.240.0060.00116.61
7.4.230.0000.00716.31
7.4.220.0090.00916.63
7.4.210.0050.01116.58
7.4.200.0030.00316.53
7.4.190.0040.00416.38
7.4.160.0090.01416.43
7.4.150.0070.01017.40
7.4.140.0100.01217.86
7.4.130.0120.00816.47
7.4.120.0090.01216.63
7.4.110.0120.00416.74
7.4.100.0160.00316.73
7.4.90.0120.00616.57
7.4.80.0090.00919.39
7.4.70.0060.00916.43
7.4.60.0160.00016.47
7.4.50.0080.00016.56
7.4.40.0040.01122.77
7.4.30.0160.00016.80
7.4.00.0080.00815.13
7.3.330.0000.00513.29
7.3.320.0000.00613.20
7.3.310.0040.00416.25
7.3.300.0070.00016.30
7.3.290.0120.00316.41
7.3.280.0110.00516.44
7.3.270.0130.00417.40
7.3.260.0070.01016.56
7.3.250.0120.00716.44
7.3.240.0110.00516.29
7.3.230.0110.00616.50
7.3.210.0100.00616.39
7.3.200.0090.00919.39
7.3.190.0110.00616.50
7.3.180.0030.01216.46
7.3.170.0030.01316.42
7.3.160.0080.01116.54
7.3.120.0070.00714.99
7.2.330.0060.01316.54
7.2.320.0000.01716.70
7.2.310.0070.01016.79
7.2.300.0160.00316.78
7.2.290.0120.00916.70
7.2.00.0040.01119.12
7.1.100.0040.00818.28
7.1.70.0000.01017.06
7.1.60.0070.01819.82
7.1.50.0060.00616.69
7.1.00.0070.07322.43
7.0.200.0180.00316.88
7.0.140.0070.07322.00
7.0.60.0070.04719.99
7.0.50.0070.07717.86
7.0.40.0170.08320.32
7.0.30.0270.08020.17
7.0.20.0230.03720.23
7.0.10.0170.08020.09
7.0.00.0030.04720.23
5.6.280.0000.07720.92
5.6.210.0070.07720.54
5.6.200.0030.07018.19
5.6.190.0100.08320.47
5.6.180.0470.07020.63
5.6.170.0200.06320.45
5.6.160.0070.07020.56
5.6.150.0030.03718.15
5.6.140.0030.08318.12
5.6.130.0130.08018.13
5.6.120.0070.09021.00
5.6.110.0200.07320.98
5.6.100.0130.07720.99
5.6.90.0030.04021.04
5.6.80.0030.08320.37
5.5.350.0400.06720.53
5.5.340.0000.07317.99
5.5.330.0030.04720.40
5.5.320.0170.06720.27
5.5.310.0270.04720.41
5.5.300.0030.08017.98
5.5.290.0030.04318.01
5.5.280.0170.07320.68
5.5.270.0070.08020.82
5.5.260.0100.07720.89
5.5.250.0100.05320.68
5.5.240.0070.03720.16
5.4.450.0700.05719.70
5.4.440.0230.05019.70
5.4.430.0170.04719.53
5.4.420.0130.05719.39
5.4.410.0130.05019.42
5.4.400.0130.05318.77
5.4.390.0100.05718.74
5.4.380.0270.05318.73
5.4.370.0270.04318.54
5.4.360.0200.05018.57
5.4.350.0300.04318.78
5.4.340.0170.05318.59
5.4.320.0050.04512.52
5.4.310.0030.04012.51
5.4.300.0060.04012.52
5.4.290.0030.04412.51
5.4.280.0100.03512.41
5.4.270.0100.06019.15
5.4.260.0170.05018.97
5.4.250.0030.07319.01
5.4.240.0100.06319.03
5.4.230.0170.08018.66
5.4.220.0070.07719.03
5.4.210.0130.07318.79
5.4.200.0170.07018.97
5.4.190.0270.05018.90
5.4.180.0130.07718.99
5.4.170.0030.07319.02
5.4.160.0130.05318.84
5.4.150.0270.05318.73
5.4.140.0100.06716.52
5.4.130.0100.05016.40
5.4.120.0170.05716.40
5.4.110.0100.05716.47
5.4.100.0100.05716.55
5.4.90.0070.05016.34
5.4.80.0170.05016.55
5.4.70.0130.05016.50
5.4.60.0100.07316.48
5.4.50.0030.05716.39
5.4.40.0130.06316.31
5.4.30.0130.06716.56
5.4.20.0170.07016.38
5.4.10.0070.05716.40
5.4.00.0070.06016.03
5.3.290.0070.04212.80
5.3.280.0100.08314.59
5.3.270.0130.06314.60
5.3.260.0130.05314.76
5.3.250.0270.06014.63
5.3.240.0100.05314.59
5.3.230.0100.05714.51
5.3.220.0030.08014.57
5.3.210.0070.06714.64
5.3.200.0070.07314.74
5.3.190.0070.06014.58
5.3.180.0130.06314.74
5.3.170.0130.05014.66
5.3.160.0200.06314.73
5.3.150.0130.06714.48
5.3.140.0170.05314.66
5.3.130.0200.06014.73
5.3.120.0100.07014.72
5.3.110.0300.05314.64
5.3.100.0070.08014.13
5.3.90.0100.05714.02
5.3.80.0030.07014.11
5.3.70.0130.05014.21
5.3.60.0130.05014.09
5.3.50.0130.06314.12
5.3.40.0130.07013.79
5.3.30.0070.06313.75
5.3.20.0030.05313.80
5.3.10.0200.05013.75
5.3.00.0170.08013.65
5.2.170.0100.05010.98
5.2.160.0100.05011.24
5.2.150.0070.05311.16
5.2.140.0030.05711.14
5.2.130.0070.05711.10
5.2.120.0100.04011.18
5.2.110.0200.03311.10
5.2.100.0030.05711.09
5.2.90.0100.05011.09
5.2.80.0130.04011.00
5.2.70.0070.06011.12
5.2.60.0100.04011.16
5.2.50.0100.05311.20
5.2.40.0070.05011.10
5.2.30.0200.04711.06
5.2.20.0130.04711.13
5.2.10.0000.04310.87
5.2.00.0170.03710.74
5.1.60.0100.04010.02
5.1.50.0100.04310.00
5.1.40.0130.03310.02
5.1.30.0130.03310.34
5.1.20.0100.04710.49
5.1.10.0100.04710.32
5.1.00.0070.04710.08
5.0.50.0170.0308.59
5.0.40.0070.0308.55
5.0.30.0030.0578.36
5.0.20.0030.0338.36
5.0.10.0100.0238.36
5.0.00.0000.0478.36
4.4.90.0000.0308.36
4.4.80.0030.0238.36
4.4.70.0100.0178.36
4.4.60.0070.0278.36
4.4.50.0100.0238.36
4.4.40.0000.0408.36
4.4.30.0070.0278.36
4.4.20.0070.0208.36
4.4.10.0130.0278.36
4.4.00.0070.0378.36
4.3.110.0100.0208.36
4.3.100.0030.0278.36
4.3.90.0100.0178.36
4.3.80.0070.0378.35
4.3.70.0000.0238.35
4.3.60.0070.0178.35
4.3.50.0000.0338.35
4.3.40.0030.0308.35
4.3.30.0000.0308.35
4.3.20.0070.0208.35
4.3.10.0000.0308.35
4.3.00.0100.0207.18

preferences:
59.74 ms | 400 KiB | 5 Q