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) << (8 - $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++) { $left = (ord($input[$i + $skip]) << $offset); $right = (ord($input[$i + $skip + 1]) & $mask) >> $offset; printf("%08b|%08b\n", $left, $right); $output[$i] = chr($left | $right); } } //0b000100010001000100000000; string_shift_left("\x11\x11\x00", 2, 10, $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.00318.43
8.3.50.0120.00621.89
8.3.40.0130.00618.63
8.3.30.0140.00019.27
8.3.20.0080.00020.34
8.3.10.0080.00022.11
8.3.00.0040.00422.42
8.2.180.0070.01516.88
8.2.170.0090.00622.96
8.2.160.0100.01019.33
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0080.00026.16
8.2.120.0040.00419.95
8.2.110.0060.00322.19
8.2.100.0040.00819.18
8.2.90.0060.00319.35
8.2.80.0040.00418.05
8.2.70.0000.00817.59
8.2.60.0080.00317.93
8.2.50.0050.00318.07
8.2.40.0040.00418.34
8.2.30.0070.00318.15
8.2.20.0040.00417.62
8.2.10.0040.00417.83
8.2.00.0020.00517.68
8.1.280.0140.00425.92
8.1.270.0030.00522.03
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00524.02
8.1.230.0070.00319.10
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0110.00017.35
8.1.190.0080.00017.52
8.1.180.0000.00818.10
8.1.170.0000.00918.55
8.1.160.0070.00022.09
8.1.150.0070.00018.66
8.1.140.0040.00417.53
8.1.130.0070.00017.79
8.1.120.0070.00017.38
8.1.110.0040.00417.46
8.1.100.0000.00717.36
8.1.90.0070.00017.36
8.1.80.0000.00817.45
8.1.70.0030.00317.41
8.1.60.0040.00417.59
8.1.50.0040.00417.50
8.1.40.0040.00417.56
8.1.30.0050.00317.71
8.1.20.0040.00417.66
8.1.10.0000.00817.62
8.1.00.0060.00317.56
8.0.300.0040.00418.77
8.0.290.0070.00017.18
8.0.280.0030.00318.39
8.0.270.0000.00717.37
8.0.260.0000.00616.77
8.0.250.0030.00316.89
8.0.240.0040.00416.89
8.0.230.0030.00316.95
8.0.220.0030.00316.94
8.0.210.0030.00316.89
8.0.200.0000.00816.96
8.0.190.0050.00216.99
8.0.180.0050.00316.93
8.0.170.0050.00316.94
8.0.160.0040.00417.01
8.0.150.0040.00416.73
8.0.140.0000.00716.79
8.0.130.0000.00513.38
8.0.120.0080.00016.89
8.0.110.0040.00416.89
8.0.100.0040.00416.91
8.0.90.0000.00716.91
8.0.80.0070.00716.89
8.0.70.0040.00416.89
8.0.60.0070.00016.82
8.0.50.0070.00016.78
8.0.30.0140.00817.12
8.0.20.0100.00917.40
8.0.10.0050.00217.03
8.0.00.0100.00716.77
7.4.330.0030.00315.00
7.4.320.0060.00016.61
7.4.300.0030.00316.43
7.4.290.0040.00416.60
7.4.280.0000.00716.53
7.4.270.0040.00416.61
7.4.260.0040.00416.61
7.4.250.0000.00716.63
7.4.240.0060.00116.54
7.4.230.0070.00016.57
7.4.220.0130.00616.61
7.4.210.0060.00916.66
7.4.200.0070.00016.60
7.4.190.0030.00316.80
7.4.160.0070.01116.62
7.4.150.0140.00317.40
7.4.140.0140.00917.86
7.4.130.0090.00816.54
7.4.120.0090.00916.54
7.4.110.0110.00516.59
7.4.100.0080.00816.70
7.4.90.0120.01216.46
7.4.80.0090.01219.39
7.4.70.0060.00916.38
7.4.60.0110.00616.52
7.4.50.0080.00016.67
7.4.40.0100.00722.77
7.4.30.0030.01316.62
7.4.10.0030.01415.08
7.4.00.0090.00615.04
7.3.330.0000.00613.32
7.3.320.0060.00013.30
7.3.310.0040.00416.29
7.3.300.0000.00616.40
7.3.290.0080.00816.34
7.3.280.0070.01016.38
7.3.270.0110.01117.40
7.3.260.0030.01416.35
7.3.250.0150.00716.52
7.3.240.0150.00316.57
7.3.230.0140.00616.39
7.3.210.0090.00916.45
7.3.200.0230.02819.39
7.3.190.0110.01116.50
7.3.180.0060.01016.44
7.3.170.0090.00616.47
7.3.160.0070.00716.56
7.3.130.0090.00914.80
7.3.120.0050.01114.82
7.3.110.0070.01014.73
7.3.100.0140.00314.84
7.3.90.0120.00614.89
7.3.80.0030.01014.99
7.3.70.0030.00914.84
7.3.60.0080.00814.75
7.3.50.0100.00314.79
7.3.40.0040.01114.64
7.3.30.0000.01014.72
7.3.20.0130.00316.71
7.3.10.0090.00416.78
7.3.00.0030.00716.60
7.2.330.0030.01516.72
7.2.320.0060.01216.80
7.2.310.0040.01416.67
7.2.300.0040.01116.50
7.2.290.0070.01016.80
7.2.260.0100.00715.30
7.2.250.0090.00915.24
7.2.240.0040.01215.30
7.2.230.0030.01315.16
7.2.220.0110.00415.24
7.2.210.0000.01414.84
7.2.200.0080.00615.03
7.2.190.0100.00715.14
7.2.180.0030.01014.88
7.2.170.0060.00314.93
7.2.160.0040.01115.05
7.2.150.0110.00416.94
7.2.140.0070.00317.01
7.2.130.0070.00817.06
7.2.120.0110.00716.90
7.2.110.0060.00616.82
7.2.100.0070.01017.02
7.2.90.0050.00816.94
7.2.80.0040.01116.80
7.2.70.0060.00816.76
7.2.60.0020.01316.92
7.2.50.0090.00816.82
7.2.40.0120.00916.80
7.2.30.0060.01116.98
7.2.20.0080.00816.96
7.2.10.0050.00716.80
7.2.00.0060.00717.04
7.1.330.0040.01215.91
7.1.320.0060.00915.58
7.1.310.0030.01315.90
7.1.300.0030.00715.95
7.1.290.0110.00315.85
7.1.280.0060.00316.01
7.1.270.0070.00715.98
7.1.260.0090.00315.93
7.1.250.0030.01015.75
7.1.240.0070.00315.71
7.1.230.0060.00315.63
7.1.220.0140.00015.74
7.1.210.0030.00615.60
7.1.200.0040.01215.88
7.1.190.0000.02015.91
7.1.180.0060.00915.95
7.1.170.0060.00915.98
7.1.160.0120.00415.75
7.1.150.0040.00815.71
7.1.140.0060.00615.57
7.1.130.0030.00915.86
7.1.120.0070.00416.04
7.1.110.0060.00615.83
7.1.100.0050.00917.13
7.1.90.0030.01415.70
7.1.80.0030.01015.79
7.1.70.0050.00616.22
7.1.60.0080.01017.69
7.1.50.0070.00916.17
7.1.40.0070.00715.92
7.1.30.0040.00815.80
7.1.20.0140.00015.85
7.1.10.0060.00615.58
7.1.00.0040.04019.21
7.0.330.0040.01115.48
7.0.320.0070.00715.45
7.0.310.0070.01015.40
7.0.300.0090.00915.36
7.0.290.0060.00915.62
7.0.280.0030.00615.66
7.0.270.0080.00815.33
7.0.260.0030.00515.44
7.0.250.0070.00715.18
7.0.240.0110.00315.55
7.0.230.0050.00915.55
7.0.220.0040.00815.57
7.0.210.0060.01015.30
7.0.200.0060.00616.02
7.0.190.0110.00415.46
7.0.180.0100.00715.48
7.0.170.0030.01515.57
7.0.160.0030.00715.50
7.0.150.0110.00415.42
7.0.140.0050.03818.71
7.0.130.0080.00615.63
7.0.120.0040.01115.37
7.0.110.0080.00815.21
7.0.100.0080.03017.66
7.0.90.0100.03217.73
7.0.80.0050.02317.71
7.0.70.0080.02017.57
7.0.60.0060.02117.74
7.0.50.0050.02217.80
7.0.40.0070.02216.72
7.0.30.0030.02716.84
7.0.20.0070.02516.82
7.0.10.0030.02516.73
7.0.00.0050.02716.81
5.6.400.0070.00714.30
5.6.390.0130.00014.33
5.6.380.0000.01314.31
5.6.370.0060.01314.77
5.6.360.0040.01114.45
5.6.350.0070.00714.73
5.6.340.0070.01014.47
5.6.330.0040.00414.34
5.6.320.0000.00914.68
5.6.310.0070.00714.46
5.6.300.0030.01314.81
5.6.290.0080.00814.80
5.6.280.0110.03517.70
5.6.270.0110.00414.41
5.6.260.0040.01114.14
5.6.250.0060.04117.48
5.6.240.0020.03117.72
5.6.230.0050.02617.59
5.6.220.0050.02217.62
5.6.210.0020.02617.59
5.6.200.0020.02617.64
5.6.190.0070.02317.72
5.6.180.0090.02317.71
5.6.170.0050.02517.66
5.6.160.0050.02517.61
5.6.150.0060.02617.61
5.6.140.0010.02617.67
5.6.130.0080.02317.65
5.6.120.0000.02417.80
5.6.110.0100.02017.79
5.6.100.0120.01817.71
5.6.90.0020.02517.68
5.6.80.0060.02017.33
5.6.70.0060.02117.50
5.6.60.0060.02017.47
5.6.50.0030.03017.47
5.6.40.0060.02317.32
5.6.30.0050.02417.18
5.6.20.0100.03817.32
5.6.10.0070.04317.17
5.6.00.0070.04417.35
5.5.380.0100.02017.48
5.5.370.0070.02217.43
5.5.360.0050.02317.31
5.5.350.0050.02817.28
5.5.340.0050.03017.53
5.5.330.0060.02417.63
5.5.320.0100.02217.62
5.5.310.0050.02217.57
5.5.300.0050.02217.65
5.5.290.0020.02817.73
5.5.280.0020.02317.63
5.5.270.0020.02817.68
5.5.260.0070.02217.37
5.5.250.0030.02317.63
5.5.240.0020.02817.23
5.5.230.0050.02317.29
5.5.220.0070.02217.18
5.5.210.0060.02317.36
5.5.200.0090.02217.32
5.5.190.0050.02317.13
5.5.180.0040.02417.24
5.5.170.0030.01314.25
5.5.160.0140.03917.21
5.5.150.0070.04417.23
5.5.140.0030.04417.33
5.5.130.0080.04017.27
5.5.120.0050.04317.25
5.5.110.0120.03817.21
5.5.100.0060.03317.21
5.5.90.0050.03917.23
5.5.80.0110.03517.14
5.5.70.0070.02917.15
5.5.60.0100.02817.10
5.5.50.0050.04217.31
5.5.40.0050.05017.32
5.5.30.0050.04217.16
5.5.20.0120.03617.25
5.5.10.0150.03617.16
5.5.00.0070.03717.25
5.4.450.0030.02115.49
5.4.440.0080.01915.56
5.4.430.0030.02415.61
5.4.420.0040.01915.45
5.4.410.0020.02215.47
5.4.400.0030.02315.30
5.4.390.0020.02315.29
5.4.380.0040.02115.43
5.4.370.0000.02815.41
5.4.360.0020.02215.43
5.4.350.0020.02515.41
5.4.340.0020.02515.40
5.4.330.0060.00811.71
5.4.320.0080.04515.37
5.4.310.0050.02115.37
5.4.300.0090.01315.37
5.4.290.0080.04015.41
5.4.280.0050.02615.41
5.4.270.0080.03615.30
5.4.260.0090.04315.38
5.4.250.0030.03515.46
5.4.240.0050.04315.46
5.4.230.0050.03815.27
5.4.220.0050.02915.42
5.4.210.0140.03015.42
5.4.200.0070.03815.49
5.4.190.0060.04215.30
5.4.180.0070.04215.42
5.4.170.0070.02715.37
5.4.160.0050.04315.36
5.4.150.0070.04315.32
5.4.140.0050.02614.04
5.4.130.0050.02514.04
5.4.120.0090.03114.03
5.4.110.0030.04114.07
5.4.100.0110.03514.07
5.4.90.0060.03914.09
5.4.80.0030.03014.04
5.4.70.0070.03814.08
5.4.60.0070.04014.06
5.4.50.0030.04114.08
5.4.40.0080.04014.10
5.4.30.0050.03814.02
5.4.20.0060.02314.09
5.4.10.0090.02914.05
5.4.00.0080.03313.67
5.3.290.0070.04213.25
5.3.280.0100.04013.23
5.3.270.0020.02913.12
5.3.260.0040.02913.13
5.3.250.0040.04013.13
5.3.240.0080.03713.23
5.3.230.0020.02513.12
5.3.220.0060.02913.17
5.3.210.0100.04113.15
5.3.200.0070.04013.19
5.3.190.0100.03813.20
5.3.180.0070.04413.15
5.3.170.0070.04013.11
5.3.160.0100.04013.11
5.3.150.0050.04213.16
5.3.140.0080.02213.16
5.3.130.0080.03413.13
5.3.120.0050.04413.10
5.3.110.0090.04213.15
5.3.100.0050.02312.89
5.3.90.0070.03812.84
5.3.80.0000.04512.86
5.3.70.0090.03412.92
5.3.60.0040.04112.87
5.3.50.0060.04012.78
5.3.40.0060.03112.87
5.3.30.0070.03812.85
5.3.20.0050.03812.74
5.3.10.0050.02212.75
5.3.00.0070.03612.69
5.2.170.0070.06011.21
5.2.160.0200.04311.02
5.2.150.0070.03011.20
5.2.140.0030.04011.21
5.2.130.0030.03710.97
5.2.120.0000.03711.22
5.2.110.0030.03311.02
5.2.100.0030.03011.18
5.2.90.0100.05311.23
5.2.80.0070.03011.01
5.2.70.0100.03311.20
5.2.60.0030.05711.13
5.2.50.0030.05311.02
5.2.40.0070.06011.03
5.2.30.0070.04710.86
5.2.20.0000.03710.89
5.2.10.0030.04710.77
5.2.00.0000.06310.79
5.1.60.0070.0439.86
5.1.50.0230.02710.09
5.1.40.0070.05010.06
5.1.30.0070.02710.34
5.1.20.0030.05710.43
5.1.10.0070.04310.12
5.1.00.0030.02310.07
5.0.50.0070.0408.64
5.0.40.0030.0178.64
5.0.30.0030.0678.64
5.0.20.0000.0408.64
5.0.10.0030.0438.64
5.0.00.0030.0608.64
4.4.90.0030.0238.64
4.4.80.0030.0378.64
4.4.70.0000.0408.64
4.4.60.0000.0308.64
4.4.50.0000.0338.64
4.4.40.0030.0478.64
4.4.30.0000.0178.64
4.4.20.0070.0278.64
4.4.10.0030.0108.64
4.4.00.0070.0408.64
4.3.110.0070.0378.64
4.3.100.0030.0308.64
4.3.90.0030.0138.64
4.3.80.0100.0438.64
4.3.70.0000.0138.64
4.3.60.0030.0178.64
4.3.50.0030.0278.64
4.3.40.0000.0338.64
4.3.30.0000.0178.64
4.3.20.0000.0338.64
4.3.10.0030.0138.64
4.3.00.0000.0208.64

preferences:
48.13 ms | 401 KiB | 5 Q