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; $output = str_pad('', $inputlen + 1, "\x00"); var_dump($skip, $copylen, $offset, $mask, $output); 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\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.0070.00716.50
8.3.60.0110.00718.31
8.3.50.0190.00522.05
8.3.40.0040.01118.79
8.3.30.0000.01419.09
8.3.20.0040.00420.38
8.3.10.0060.00321.97
8.3.00.0040.00422.30
8.2.190.0100.01316.75
8.2.180.0150.00616.63
8.2.170.0120.00322.96
8.2.160.0070.00719.29
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0040.00419.26
8.2.110.0060.00322.01
8.2.100.0040.00819.45
8.2.90.0030.00519.22
8.2.80.0000.00918.05
8.2.70.0040.00417.38
8.2.60.0040.00717.80
8.2.50.0030.00818.07
8.2.40.0040.00418.16
8.2.30.0080.00018.12
8.2.20.0000.00717.65
8.2.10.0050.00319.53
8.2.00.0000.00717.81
8.1.280.0070.00725.92
8.1.270.0000.00721.91
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00323.66
8.1.230.0070.00318.96
8.1.220.0040.00417.79
8.1.210.0060.00318.77
8.1.200.0000.01017.25
8.1.190.0040.00417.40
8.1.180.0030.00518.10
8.1.170.0040.00418.59
8.1.160.0000.00721.90
8.1.150.0070.00018.54
8.1.140.0040.00417.34
8.1.130.0070.00017.82
8.1.120.0070.00017.37
8.1.110.0040.00417.34
8.1.100.0070.00017.51
8.1.90.0050.00517.40
8.1.80.0080.00017.36
8.1.70.0030.00317.36
8.1.60.0030.00517.47
8.1.50.0000.00817.48
8.1.40.0040.00417.55
8.1.30.0040.00417.56
8.1.20.0030.00517.57
8.1.10.0040.00417.61
8.1.00.0040.00417.54
8.0.300.0000.00718.77
8.0.290.0000.00817.18
8.0.280.0030.00318.45
8.0.270.0050.00317.18
8.0.260.0030.00316.83
8.0.250.0000.00716.95
8.0.240.0060.00316.94
8.0.230.0030.00316.95
8.0.220.0030.00316.93
8.0.210.0000.00716.81
8.0.200.0030.00316.81
8.0.190.0040.00416.88
8.0.180.0000.00816.96
8.0.170.0090.00016.91
8.0.160.0060.00316.87
8.0.150.0030.00316.94
8.0.140.0000.00816.75
8.0.130.0060.00013.37
8.0.120.0040.00416.77
8.0.110.0070.00016.91
8.0.100.0000.00716.95
8.0.90.0040.00416.86
8.0.80.0080.00816.96
8.0.70.0040.00416.86
8.0.60.0050.00216.91
8.0.50.0080.00016.74
8.0.30.0100.01117.00
8.0.20.0090.00917.41
8.0.10.0000.00816.91
8.0.00.0100.01216.80
7.4.330.0070.00015.00
7.4.320.0000.00616.61
7.4.300.0020.00516.54
7.4.290.0070.00016.52
7.4.280.0000.00716.50
7.4.270.0000.00716.63
7.4.260.0040.00416.64
7.4.250.0040.00416.37
7.4.240.0060.00216.50
7.4.230.0070.00016.51
7.4.220.0200.00616.55
7.4.210.0060.00816.52
7.4.200.0070.00016.51
7.4.190.0040.00416.57
7.4.160.0060.00916.55
7.4.150.0070.01017.40
7.4.140.0050.01517.86
7.4.130.0100.00816.56
7.4.120.0060.01116.47
7.4.110.0130.00316.46
7.4.100.0130.01016.33
7.4.90.0070.01016.41
7.4.80.0070.01019.39
7.4.70.0130.00316.63
7.4.60.0090.00916.54
7.4.50.0030.00516.49
7.4.40.0060.01222.77
7.4.30.0130.00316.43
7.4.10.0030.01414.77
7.4.00.0070.00815.02
7.3.330.0000.00513.33
7.3.320.0050.00013.24
7.3.310.0000.00816.48
7.3.300.0000.00716.23
7.3.290.0060.01016.37
7.3.280.0110.00416.36
7.3.270.0090.00917.40
7.3.260.0110.00716.55
7.3.250.0140.00816.62
7.3.240.0150.00316.39
7.3.230.0030.01716.39
7.3.210.0060.01116.36
7.3.200.0070.01119.39
7.3.190.0100.00716.76
7.3.180.0120.00316.25
7.3.170.0100.01016.66
7.3.160.0060.01016.60
7.3.130.0130.00615.12
7.3.120.0050.01015.02
7.3.110.0030.01414.93
7.3.100.0060.00815.08
7.3.90.0060.00814.96
7.3.80.0070.00714.91
7.3.70.0040.00814.80
7.3.60.0070.01014.91
7.3.50.0040.01114.76
7.3.40.0030.00814.89
7.3.30.0030.00814.92
7.3.20.0060.00916.70
7.3.10.0050.00916.72
7.3.00.0050.00816.71
7.2.330.0120.00616.55
7.2.320.0090.00916.82
7.2.310.0100.01316.39
7.2.300.0090.00616.86
7.2.290.0080.00816.76
7.2.260.0030.01314.61
7.2.250.0070.01115.19
7.2.240.0060.01114.94
7.2.230.0100.00515.27
7.2.220.0030.00914.64
7.2.210.0040.01115.03
7.2.200.0040.00715.21
7.2.190.0060.00615.14
7.2.180.0060.00914.92
7.2.170.0040.00915.22
7.2.160.0060.00315.25
7.2.150.0140.00317.12
7.2.140.0090.00616.95
7.2.130.0000.01516.77
7.2.120.0060.00816.93
7.2.110.0090.00716.91
7.2.100.0070.01016.99
7.2.90.0090.00516.94
7.2.80.0070.00716.66
7.2.70.0040.00916.94
7.2.60.0070.00517.12
7.2.50.0020.01117.07
7.2.40.0060.00716.94
7.2.30.0030.00616.96
7.2.20.0080.00616.86
7.2.10.0080.00916.85
7.2.00.0050.01017.75
7.1.330.0090.00315.70
7.1.320.0030.00915.78
7.1.310.0100.00315.69
7.1.300.0080.01015.94
7.1.290.0030.00715.70
7.1.280.0050.00715.97
7.1.270.0050.01015.67
7.1.260.0060.00415.86
7.1.250.0060.00815.70
7.1.240.0080.00515.87
7.1.230.0060.00815.71
7.1.220.0050.00815.81
7.1.210.0070.00715.95
7.1.200.0030.00815.64
7.1.190.0020.00915.71
7.1.180.0050.00515.73
7.1.170.0050.00715.81
7.1.160.0040.00715.75
7.1.150.0070.00515.83
7.1.140.0050.00915.95
7.1.130.0060.00715.79
7.1.120.0070.00715.73
7.1.110.0030.01115.81
7.1.100.0080.00716.61
7.1.90.0050.00515.57
7.1.80.0000.01215.80
7.1.70.0040.00616.41
7.1.60.0040.01117.08
7.1.50.0060.00416.24
7.1.40.0070.00215.88
7.1.30.0080.00315.91
7.1.20.0020.01115.82
7.1.10.0030.00715.84
7.1.00.0050.03617.96
7.0.330.0040.00615.40
7.0.320.0060.00715.48
7.0.310.0050.00515.37
7.0.300.0050.00615.42
7.0.290.0020.00915.32
7.0.280.0090.00515.37
7.0.270.0020.01115.28
7.0.260.0050.01015.41
7.0.250.0060.00615.30
7.0.240.0030.00815.39
7.0.230.0030.00715.47
7.0.220.0050.00815.54
7.0.210.0090.00315.27
7.0.200.0090.00615.84
7.0.190.0040.00815.39
7.0.180.0050.00515.36
7.0.170.0050.00715.37
7.0.160.0050.00315.40
7.0.150.0030.00615.36
7.0.140.0020.03317.67
7.0.130.0050.00815.31
7.0.120.0060.00615.50
7.0.110.0020.00815.46
7.0.100.0100.00115.49
7.0.90.0040.01015.45
7.0.80.0110.00215.47
7.0.70.0050.00715.37
7.0.60.0080.03316.92
7.0.50.0060.03116.25
7.0.40.0100.02815.57
7.0.30.0110.01915.61
7.0.20.0110.02015.78
7.0.10.0110.01815.68
7.0.00.0040.02115.84
5.6.400.0040.00814.33
5.6.390.0040.00414.09
5.6.380.0030.00714.72
5.6.370.0080.00514.33
5.6.360.0050.00814.44
5.6.350.0040.00814.41
5.6.340.0060.00614.04
5.6.330.0030.01014.33
5.6.320.0030.01014.39
5.6.310.0050.00814.38
5.6.300.0050.00914.36
5.6.290.0020.01014.55
5.6.280.0090.02416.47
5.6.270.0080.00514.20
5.6.260.0050.00814.52
5.6.250.0060.00814.35
5.6.240.0050.00814.35
5.6.230.0080.00314.29
5.6.220.0060.00814.58
5.6.210.0100.02816.41
5.6.200.0070.02715.67
5.6.190.0040.03616.47
5.6.180.1230.01616.56
5.6.170.0140.01316.33
5.6.160.0050.03416.47
5.6.150.0090.02515.71
5.6.140.0050.03115.57
5.6.130.0050.02615.62
5.6.120.0060.02316.69
5.6.110.0080.03416.55
5.6.100.0100.02816.61
5.6.90.0120.03016.52
5.6.80.0090.03016.35
5.6.70.0160.02316.33
5.6.60.0040.00714.36
5.6.50.0070.00714.33
5.6.40.0010.01314.19
5.6.30.0070.00414.11
5.6.20.0020.01014.36
5.6.10.0050.00614.34
5.6.00.0020.00914.23
5.5.380.0050.00612.67
5.5.370.0040.00812.93
5.5.360.0070.00312.85
5.5.350.0070.02315.40
5.5.340.0020.02314.58
5.5.330.0080.03115.15
5.5.320.0090.01915.27
5.5.310.0150.02815.32
5.5.300.0070.01914.55
5.5.290.0020.02514.43
5.5.280.0110.01915.49
5.5.270.0080.03115.30
5.5.260.0040.03615.24
5.5.250.0080.02615.22
5.5.240.0070.02415.14
5.5.230.0050.00512.79
5.5.220.0050.00612.68
5.5.210.0080.00712.70
5.5.200.0000.01512.81
5.5.190.0050.01012.74
5.5.180.0060.00812.79
5.5.170.0070.00512.63
5.5.160.0050.00812.81
5.5.150.0060.00412.72
5.5.140.0030.00912.83
5.5.130.0050.00512.67
5.5.120.0050.00612.59
5.5.110.0070.00712.65
5.5.100.0070.00712.77
5.5.90.0070.00612.78
5.5.80.0050.00612.72
5.5.70.0080.00312.76
5.5.60.0040.00812.67
5.5.50.0070.00412.92
5.5.40.0010.01012.95
5.5.30.0040.01112.59
5.5.20.0000.01212.68
5.5.10.0050.00612.78
5.5.00.0020.00912.68
5.4.450.0120.02014.20
5.4.440.0120.02614.22
5.4.430.0070.02314.17
5.4.420.0090.02114.10
5.4.410.0060.02114.04
5.4.400.0080.02113.95
5.4.390.0010.02413.90
5.4.380.0110.02113.89
5.4.370.0140.01713.73
5.4.360.0080.02113.81
5.4.350.0100.02013.82
5.4.340.0110.02113.77
5.4.330.0030.00411.42
5.4.320.0040.01911.68
5.4.310.0050.01711.77
5.4.300.0020.02211.78
5.4.290.0080.01611.76
5.4.280.0050.01711.74
5.4.270.0020.02513.80
5.4.260.0100.02113.85
5.4.250.0070.02813.90
5.4.240.0070.02913.88
5.4.230.0110.02513.89
5.4.220.0080.02013.77
5.4.210.0070.02913.94
5.4.200.0060.02113.93
5.4.190.0080.02813.92
5.4.180.0040.02513.88
5.4.170.0040.02713.99
5.4.160.0060.02813.86
5.4.150.0060.03013.95
5.4.140.0060.02113.05
5.4.130.0070.02513.17
5.4.120.0070.02413.27
5.4.110.0070.02313.14
5.4.100.0080.02213.09
5.4.90.0060.02113.04
5.4.80.0070.02913.00
5.4.70.0060.02113.15
5.4.60.0040.02113.06
5.4.50.0050.02213.10
5.4.40.0070.02113.06
5.4.30.0070.02613.08
5.4.20.0080.02613.06
5.4.10.0070.01813.12
5.4.00.0040.02212.86
5.3.290.0080.01711.76
5.3.280.0060.02312.25
5.3.270.0050.02212.29
5.3.260.0090.02312.33
5.3.250.0090.02512.37
5.3.240.0100.02512.31
5.3.230.0100.02312.29
5.3.220.0070.02712.30
5.3.210.0070.02912.26
5.3.200.0070.02912.34
5.3.190.0140.01912.29
5.3.180.0040.02012.23
5.3.170.0050.02812.25
5.3.160.0060.02312.34
5.3.150.0060.02312.29
5.3.140.0030.02912.32
5.3.130.0090.01912.25
5.3.120.0020.03012.25
5.3.110.0060.02612.30
5.3.100.0040.02012.14
5.3.90.0060.02112.17
5.3.80.0100.02212.07
5.3.70.0040.02212.04
5.3.60.0040.02112.07
5.3.50.0090.02412.00
5.3.40.0080.02212.10
5.3.30.0060.02112.07
5.3.20.0050.02111.92
5.3.10.0070.01911.87
5.3.00.0030.03011.86
5.2.170.0020.02910.54
5.2.160.0080.02010.55
5.2.150.0040.03410.55
5.2.140.0060.03210.60
5.2.130.0080.02310.54
5.2.120.0060.02910.46
5.2.110.0060.02810.58
5.2.100.0080.01810.58
5.2.90.0070.02410.58
5.2.80.0070.01810.53
5.2.70.0020.02810.63
5.2.60.0020.02610.50
5.2.50.0070.01910.60
5.2.40.0030.03210.58
5.2.30.0080.03010.46
5.2.20.0100.01810.50
5.2.10.0130.02010.46
5.2.00.0140.02510.40
5.1.60.0050.02610.07
5.1.50.0030.02110.02
5.1.40.0000.0219.97
5.1.30.0050.02010.19
5.1.20.0050.02610.21
5.1.10.0050.02010.07
5.1.00.0030.02610.02
5.0.50.0020.0209.34
5.0.40.0020.0229.18
5.0.30.0070.0259.23
5.0.20.0020.0169.14
5.0.10.0090.0199.08
5.0.00.0080.0239.10
4.4.90.0030.0197.90
4.4.80.0030.0157.90
4.4.70.0030.0137.91
4.4.60.0030.0157.90
4.4.50.0070.0137.91
4.4.40.0000.0217.92
4.4.30.0050.0157.92
4.4.20.0100.0107.95
4.4.10.0080.0127.94
4.4.00.0020.0217.93
4.3.110.0020.0147.90
4.3.100.0050.0137.90
4.3.90.0030.0127.90
4.3.80.0040.0207.90
4.3.70.0030.0157.90
4.3.60.0050.0137.93
4.3.50.0020.0187.90
4.3.40.0010.0257.90
4.3.30.0050.0127.90
4.3.20.0030.0187.90
4.3.10.0020.0127.90
4.3.00.0020.0138.67

preferences:
51.14 ms | 401 KiB | 5 Q