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.0100.01018.62
8.3.50.0080.00921.96
8.3.40.0120.00318.71
8.3.30.0100.00319.22
8.3.20.0000.00720.31
8.3.10.0060.00321.92
8.3.00.0040.00422.51
8.2.180.0070.01116.88
8.2.170.0080.00622.96
8.2.160.0080.00520.98
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.24
8.2.110.0110.00722.08
8.2.100.0040.00818.03
8.2.90.0030.00518.03
8.2.80.0060.00317.97
8.2.70.0040.00417.63
8.2.60.0060.00317.93
8.2.50.0080.00318.07
8.2.40.0040.00418.16
8.2.30.0060.00318.02
8.2.20.0000.00817.66
8.2.10.0040.00419.44
8.2.00.0000.00817.70
8.1.280.0100.00725.92
8.1.270.0070.00022.14
8.1.260.0080.00026.35
8.1.250.0060.00328.09
8.1.240.0100.00022.61
8.1.230.0110.00022.72
8.1.220.0040.00417.74
8.1.210.0000.00918.95
8.1.200.0040.00717.48
8.1.190.0060.00317.41
8.1.180.0000.00818.10
8.1.170.0000.00818.66
8.1.160.0000.00822.02
8.1.150.0000.00718.63
8.1.140.0040.00417.38
8.1.130.0000.00717.84
8.1.120.0040.00417.38
8.1.110.0030.00617.44
8.1.100.0070.00017.48
8.1.90.0000.00717.28
8.1.80.0000.00817.52
8.1.70.0050.00317.36
8.1.60.0070.00017.55
8.1.50.0040.00417.46
8.1.40.0000.00717.58
8.1.30.0000.00817.56
8.1.20.0060.00317.50
8.1.10.0040.00417.49
8.1.00.0050.00517.38
8.0.300.0000.00719.98
8.0.290.0070.00017.18
8.0.280.0000.00818.39
8.0.270.0030.00317.27
8.0.260.0000.00616.84
8.0.250.0000.00717.04
8.0.240.0030.00316.87
8.0.230.0000.00716.88
8.0.220.0030.00316.92
8.0.210.0040.00417.01
8.0.200.0000.00616.96
8.0.190.0030.00516.99
8.0.180.0000.00817.03
8.0.170.0050.00316.88
8.0.160.0040.00416.91
8.0.150.0030.00316.83
8.0.140.0030.00316.81
8.0.130.0000.00513.36
8.0.120.0000.00816.91
8.0.110.0070.00016.98
8.0.100.0040.00417.08
8.0.90.0040.00416.96
8.0.80.0110.01116.91
8.0.70.0000.00716.77
8.0.60.0040.00416.96
8.0.50.0040.00416.86
8.0.30.0110.00917.00
8.0.20.0070.01017.40
8.0.10.0000.00816.97
8.0.00.0060.01316.84
7.4.330.0060.00015.00
7.4.320.0030.00316.45
7.4.300.0000.00716.45
7.4.290.0030.00316.62
7.4.280.0040.00416.51
7.4.270.0000.00816.46
7.4.260.0070.00016.50
7.4.250.0000.00716.63
7.4.240.0020.00516.53
7.4.230.0000.00716.42
7.4.220.0130.00316.45
7.4.210.0100.00716.59
7.4.200.0070.00016.59
7.4.190.0000.00716.38
7.4.160.0150.00016.47
7.4.150.0090.00817.40
7.4.140.0110.00817.86
7.4.130.0130.00916.59
7.4.120.0170.00316.47
7.4.110.0120.00616.63
7.4.100.0090.00916.61
7.4.90.0070.01016.68
7.4.80.0140.00919.39
7.4.70.0060.00916.52
7.4.60.0100.00716.33
7.4.50.0030.00616.58
7.4.40.0060.00822.77
7.4.30.0080.00816.62
7.4.10.0040.01115.09
7.4.00.0080.00915.01
7.3.330.0000.00513.30
7.3.320.0000.00613.41
7.3.310.0050.00516.48
7.3.300.0050.00316.35
7.3.290.0140.00616.41
7.3.280.0100.00716.40
7.3.270.0140.00717.40
7.3.260.0090.00916.65
7.3.250.0090.01116.69
7.3.240.0130.00316.44
7.3.230.0000.01716.54
7.3.210.0060.01016.51
7.3.200.0170.00019.39
7.3.190.0060.01316.44
7.3.180.0060.00916.45
7.3.170.0080.00816.69
7.3.160.0070.01016.52
7.3.130.0090.00614.93
7.3.120.0070.00914.94
7.3.110.0080.01014.83
7.3.100.0060.01014.95
7.3.90.0080.00814.88
7.3.80.0080.00614.82
7.3.70.0050.01014.98
7.3.60.0030.01214.85
7.3.50.0080.00714.63
7.3.40.0080.00314.90
7.3.30.0060.00414.84
7.3.20.0060.00916.63
7.3.10.0030.01016.73
7.3.00.0100.00316.84
7.2.330.0000.01816.80
7.2.320.0100.00716.71
7.2.310.0140.00416.82
7.2.300.0160.00616.52
7.2.290.0070.01416.73
7.2.260.0070.01315.24
7.2.250.0070.01115.20
7.2.240.0100.00815.24
7.2.230.0050.01115.14
7.2.220.0070.00915.25
7.2.210.0080.00815.15
7.2.200.0070.00615.05
7.2.190.0040.00615.04
7.2.180.0030.00814.97
7.2.170.0100.00714.95
7.2.160.0040.00815.15
7.2.150.0060.00316.68
7.2.140.0110.00417.13
7.2.130.0030.01016.93
7.2.120.0070.01016.68
7.2.110.0310.01016.75
7.2.100.0030.01317.07
7.2.90.0000.01416.99
7.2.80.0040.01216.94
7.2.70.0070.00317.18
7.2.60.0040.00916.96
7.2.50.0080.00416.63
7.2.40.0070.01017.20
7.2.30.0090.00616.93
7.2.20.0110.00416.92
7.2.10.0030.01317.00
7.2.00.0050.00818.17
7.1.330.0070.00815.69
7.1.320.0090.00715.73
7.1.310.0060.00915.80
7.1.300.0070.00915.90
7.1.290.0030.00915.73
7.1.280.0030.01015.72
7.1.270.0050.01015.73
7.1.260.0050.00815.69
7.1.250.0000.00915.75
7.1.240.0130.00015.65
7.1.230.0070.00715.93
7.1.220.0030.00915.84
7.1.210.0060.00615.71
7.1.200.0030.00915.87
7.1.190.0000.01015.94
7.1.180.0000.01515.84
7.1.170.0040.01115.68
7.1.160.0070.00715.68
7.1.150.0070.00715.86
7.1.140.0000.01415.64
7.1.130.0070.00315.86
7.1.120.0080.00815.68
7.1.110.0000.01415.78
7.1.100.0110.00417.11
7.1.90.0070.00715.67
7.1.80.0030.00615.88
7.1.70.0020.01416.42
7.1.60.0110.01117.81
7.1.50.0030.01516.31
7.1.40.0060.00315.95
7.1.30.0060.00915.89
7.1.20.0030.00615.88
7.1.10.0040.00815.86
7.1.00.0040.04119.05
7.0.330.0040.00715.39
7.0.320.0060.00615.39
7.0.310.0080.00815.44
7.0.300.0030.01015.62
7.0.290.0000.00915.56
7.0.280.0060.00915.35
7.0.270.0000.01515.12
7.0.260.0070.00715.34
7.0.250.0060.00915.45
7.0.240.0030.00815.31
7.0.230.0030.00615.41
7.0.220.0070.00715.52
7.0.210.0070.00715.57
7.0.200.0050.01116.18
7.0.190.0060.00615.36
7.0.180.0060.00615.41
7.0.170.0090.00415.46
7.0.160.0050.00415.45
7.0.150.0060.00915.39
7.0.140.0050.04018.72
7.0.130.0060.00615.29
7.0.120.0090.00315.61
7.0.110.0080.00615.55
7.0.100.0060.00615.53
7.0.90.0090.00015.53
7.0.80.0060.00615.21
7.0.70.0130.00315.52
7.0.60.0050.04217.60
7.0.50.0080.02116.73
7.0.40.0030.03216.89
7.0.30.0130.04516.84
7.0.20.0080.03016.94
7.0.10.0090.03516.82
7.0.00.0030.03016.77
5.6.400.0070.00314.85
5.6.390.0100.00314.29
5.6.380.0040.00814.32
5.6.370.0030.00614.62
5.6.360.0060.01014.47
5.6.350.0030.00614.63
5.6.340.0000.01414.70
5.6.330.0060.00614.48
5.6.320.0000.00914.64
5.6.310.0090.00614.59
5.6.300.0030.01214.77
5.6.290.0000.01214.58
5.6.280.0100.03517.81
5.6.270.0000.01614.67
5.6.260.0000.01314.09
5.6.250.0000.01114.54
5.6.240.0000.01514.36
5.6.230.0100.00314.63
5.6.220.0070.01014.41
5.6.210.0060.02417.57
5.6.200.0120.03016.38
5.6.190.0030.04617.53
5.6.180.2030.02317.47
5.6.170.0160.04617.53
5.6.160.0100.04517.34
5.6.150.0060.02516.22
5.6.140.0080.02616.43
5.6.130.0050.04016.30
5.6.120.0030.03217.68
5.6.110.0050.04817.61
5.6.100.0070.02717.70
5.6.90.0060.04817.81
5.6.80.0100.04217.49
5.6.70.2280.02317.28
5.6.60.0040.00414.26
5.6.50.0130.00314.54
5.6.40.0090.00614.44
5.6.30.0030.00914.23
5.6.20.0030.00614.61
5.6.10.0090.00614.61
5.6.00.0070.00714.47
5.5.380.0030.00614.59
5.5.370.0070.01014.63
5.5.360.0070.00314.66
5.5.350.0150.04417.46
5.5.340.0100.02516.26
5.5.330.0070.03617.37
5.5.320.1720.02817.36
5.5.310.0120.04217.47
5.5.300.0020.04816.13
5.5.290.0070.04516.22
5.5.280.0110.04117.67
5.5.270.0020.03417.69
5.5.260.0080.04017.50
5.5.250.0060.04417.38
5.5.240.0170.04217.37
5.5.230.0040.00714.33
5.5.220.0070.00714.37
5.5.210.0060.00914.46
5.5.200.0090.00314.01
5.5.190.0030.00914.25
5.5.180.0060.00914.17
5.5.170.0060.00614.19
5.5.160.0080.00814.29
5.5.150.0120.00314.43
5.5.140.0060.00914.32
5.5.130.0080.00414.23
5.5.120.0150.00014.15
5.5.110.0030.00514.55
5.5.100.0030.00614.40
5.5.90.0060.00614.17
5.5.80.0070.00313.95
5.5.70.0080.00014.16
5.5.60.0060.00914.25
5.5.50.0130.00314.37
5.5.40.0000.01614.36
5.5.30.0080.00314.45
5.5.20.0040.01114.39
5.5.10.0070.00714.35
5.5.00.0000.01414.31
5.4.450.0300.04115.24
5.4.440.0180.03615.48
5.4.430.0070.03315.24
5.4.420.0030.03215.40
5.4.410.0130.02515.35
5.4.400.0130.02315.07
5.4.390.0030.03115.01
5.4.380.0240.03014.95
5.4.370.0160.02515.04
5.4.360.0110.02615.03
5.4.350.0150.02614.94
5.4.340.0190.02314.90
5.4.330.0060.00611.27
5.4.320.0060.02111.89
5.4.310.0070.02111.89
5.4.300.0070.02311.89
5.4.290.0060.02211.89
5.4.280.0090.01711.84
5.4.270.0050.04115.02
5.4.260.0030.03415.11
5.4.250.0060.03515.11
5.4.240.0130.03815.20
5.4.230.0120.03715.00
5.4.220.0070.04015.23
5.4.210.0130.03114.96
5.4.200.0070.03015.13
5.4.190.0080.03715.26
5.4.180.0050.03915.13
5.4.170.0030.03315.14
5.4.160.0100.02815.02
5.4.150.0120.02615.14
5.4.140.0100.03213.79
5.4.130.0120.03514.00
5.4.120.0100.03213.82
5.4.110.0080.02813.82
5.4.100.0060.04013.94
5.4.90.0030.03313.94
5.4.80.0130.02013.95
5.4.70.0110.03413.83
5.4.60.0080.03813.90
5.4.50.0050.03713.95
5.4.40.0090.02913.96
5.4.30.0080.03013.94
5.4.20.0030.04313.83
5.4.10.0160.03513.85
5.4.00.0050.04013.59
5.3.290.0020.02312.04
5.3.280.0090.03212.85
5.3.270.0050.03312.86
5.3.260.0150.03512.98
5.3.250.0120.03312.98
5.3.240.0170.02813.01
5.3.230.0120.02613.05
5.3.220.0060.03612.96
5.3.210.0090.03013.01
5.3.200.0050.03712.97
5.3.190.0050.03012.91
5.3.180.0030.03812.95
5.3.170.0110.03112.87
5.3.160.0070.03112.99
5.3.150.0080.03012.92
5.3.140.0070.02712.91
5.3.130.0070.03212.90
5.3.120.0080.03312.99
5.3.110.0080.03813.03
5.3.100.0130.02112.70
5.3.90.0070.03212.66
5.3.80.0080.03012.65
5.3.70.0060.03012.63
5.3.60.0100.03512.69
5.3.50.0020.04012.65
5.3.40.0070.03312.62
5.3.30.0090.03712.55
5.3.20.0070.03512.53
5.3.10.0100.02412.51
5.3.00.0050.03712.38
5.2.170.0100.04011.38
5.2.160.0000.04711.00
5.2.150.0100.04311.23
5.2.140.0130.04311.12
5.2.130.0100.05011.20
5.2.120.0170.03011.28
5.2.110.0070.04311.12
5.2.100.0030.06011.20
5.2.90.0000.04310.96
5.2.80.0170.05311.19
5.2.70.0000.06711.32
5.2.60.0030.05011.16
5.2.50.0030.05311.00
5.2.40.0100.03711.00
5.2.30.0170.04711.07
5.2.20.0000.05311.05
5.2.10.0130.03310.94
5.2.00.0070.04310.81
5.1.60.0100.03010.02
5.1.50.0170.03010.10
5.1.40.0100.0379.98
5.1.30.0000.05010.42
5.1.20.0070.03710.53
5.1.10.0000.05010.03
5.1.00.0170.03310.13
5.0.50.0030.0408.76
5.0.40.0100.0278.36
5.0.30.0100.0378.36
5.0.20.0100.0208.36
5.0.10.0100.0338.36
5.0.00.0070.0508.36
4.4.90.0030.0236.87
4.4.80.0100.0276.87
4.4.70.0070.0306.87
4.4.60.0070.0276.81
4.4.50.0100.0278.36
4.4.40.0000.0378.36
4.4.30.0000.0238.36
4.4.20.0000.0308.36
4.4.10.0130.0308.36
4.4.00.0000.0378.36
4.3.110.0030.0278.36
4.3.100.0030.0308.36
4.3.90.0070.0208.36
4.3.80.0070.0308.36
4.3.70.0030.0238.36
4.3.60.0030.0278.36
4.3.50.0000.0278.36
4.3.40.0000.0378.36
4.3.30.0030.0208.36
4.3.20.0030.0238.36
4.3.10.0030.0208.36
4.3.00.0030.0277.38

preferences:
46.85 ms | 401 KiB | 5 Q