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) & 0xff; $mask = ~(0xff >> (8 - $offset)) & 0xff; $output = str_pad('', $inputlen + 1, "\x00"); echo "$skip $copylen $offset $mask\n"; 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("%02x ", ($left | $right) & 0xff); $output[$i] = chr(($left | $right) & 0xff); } } //0b000100010001000100000000; $input = "abc\x00"; $bits = 2; string_shift_left($input, strlen($input) - 1, $bits, $output); for ($i = 0; $i < strlen($input); $i++) { printf("\n%02x: %08b", ord($input[$i]), ord($input[$i])); } for ($i = 0; $i < strlen($output); $i++) { printf("\n%02x: %08b", ord($output[$i]), 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.0140.00418.43
8.3.60.0120.00918.43
8.3.50.0050.01022.07
8.3.40.0060.01018.67
8.3.30.0070.00719.17
8.3.20.0050.00320.25
8.3.10.0050.00222.09
8.3.00.0050.00322.46
8.2.190.0110.00718.54
8.2.180.0140.00316.50
8.2.170.0140.00422.96
8.2.160.0170.00019.23
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00926.16
8.2.120.0050.00317.50
8.2.110.0090.00022.07
8.2.100.0000.01218.22
8.2.90.0060.00319.39
8.2.80.0050.00318.05
8.2.70.0030.00617.63
8.2.60.0080.00317.55
8.2.50.0050.00318.07
8.2.40.0050.00318.34
8.2.30.0000.01018.05
8.2.20.0050.00517.79
8.2.10.0060.00317.64
8.2.00.0030.00617.79
8.1.280.0110.00325.92
8.1.270.0040.00422.00
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0030.00623.97
8.1.230.0060.00619.03
8.1.220.0000.01017.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0060.00317.63
8.1.180.0050.00318.10
8.1.170.0090.00018.64
8.1.160.0050.00222.03
8.1.150.0040.00418.54
8.1.140.0000.00817.51
8.1.130.0000.00817.82
8.1.120.0040.00417.54
8.1.110.0070.00017.34
8.1.100.0040.00417.37
8.1.90.0040.00417.37
8.1.80.0000.00717.37
8.1.70.0030.00317.46
8.1.60.0060.00317.63
8.1.50.0030.00517.54
8.1.40.0000.00817.52
8.1.30.0000.00717.66
8.1.20.0000.00817.53
8.1.10.0080.00017.58
8.1.00.0080.00017.43
8.0.300.0040.00418.77
8.0.290.0000.00717.30
8.0.280.0000.00718.45
8.0.270.0080.00017.32
8.0.260.0060.00318.52
8.0.250.0030.00316.93
8.0.240.0070.00016.86
8.0.230.0030.00516.87
8.0.220.0000.00716.89
8.0.210.0050.00216.95
8.0.200.0000.00816.86
8.0.190.0050.00316.86
8.0.180.0040.00416.82
8.0.170.0000.00716.86
8.0.160.0000.00816.88
8.0.150.0000.00716.80
8.0.140.0040.00416.78
8.0.130.0000.00613.37
8.0.120.0000.00716.75
8.0.110.0000.00716.97
8.0.100.0000.00716.79
8.0.90.0040.00416.73
8.0.80.0110.00416.88
8.0.70.0000.00716.95
8.0.60.0030.00616.69
8.0.50.0000.00716.80
8.0.30.0170.00517.14
8.0.20.0160.00317.40
8.0.10.0040.00416.98
8.0.00.0090.00916.70
7.4.330.0030.00315.00
7.4.320.0000.00716.44
7.4.300.0000.00616.51
7.4.290.0000.00716.61
7.4.280.0040.00416.51
7.4.270.0000.00716.52
7.4.260.0030.00316.63
7.4.250.0040.00416.57
7.4.240.0070.00016.54
7.4.230.0000.00716.63
7.4.220.0070.01116.55
7.4.210.0060.01016.54
7.4.200.0040.00416.35
7.4.190.0030.00316.72
7.4.160.0090.00916.46
7.4.150.0140.00417.40
7.4.140.0130.00617.86
7.4.130.0090.01016.52
7.4.120.0040.01316.58
7.4.110.0040.01216.54
7.4.100.0180.00016.44
7.4.90.0140.00316.61
7.4.80.0280.02319.39
7.4.70.0160.00016.30
7.4.60.0080.00816.30
7.4.50.0040.00416.42
7.4.40.0040.00822.77
7.4.30.0030.01316.38
7.4.10.0060.01214.66
7.4.00.0100.00515.02
7.3.330.0050.00013.24
7.3.320.0050.00013.13
7.3.310.0000.00716.39
7.3.300.0030.00316.24
7.3.290.0030.01016.38
7.3.280.0080.00816.36
7.3.270.0060.01417.40
7.3.260.0080.00816.49
7.3.250.0090.00916.44
7.3.240.0120.00616.54
7.3.230.0160.00616.39
7.3.210.0070.01116.63
7.3.200.0120.01019.39
7.3.190.0150.00716.46
7.3.180.0120.00316.43
7.3.170.0100.01016.42
7.3.160.0110.00716.56
7.3.130.0040.01414.86
7.3.120.0060.00914.84
7.3.110.0070.01014.88
7.3.100.0080.00514.93
7.3.90.0080.00814.88
7.3.80.0090.00614.86
7.3.70.0050.00914.89
7.3.60.0040.01114.90
7.3.50.0040.00714.92
7.3.40.0050.00914.90
7.3.30.0050.01114.90
7.3.20.0020.01516.67
7.3.10.0080.00516.78
7.3.00.0080.00616.64
7.2.330.0090.00916.75
7.2.320.0060.01216.64
7.2.310.0130.00916.45
7.2.300.0100.00616.86
7.2.290.0070.01316.88
7.2.260.0070.01415.15
7.2.250.0060.00915.29
7.2.240.0030.01115.00
7.2.230.0080.00715.21
7.2.220.0090.00815.21
7.2.210.0090.00615.04
7.2.200.0050.00615.15
7.2.190.0060.00915.07
7.2.180.0080.00515.07
7.2.170.0030.01415.30
7.2.160.0080.00814.96
7.2.150.0100.00516.92
7.2.140.0050.01116.79
7.2.130.0060.00617.05
7.2.120.0080.00716.88
7.2.110.0000.01017.02
7.2.100.0050.01016.93
7.2.90.0000.01017.00
7.2.80.0040.00916.90
7.2.70.0050.00816.85
7.2.60.0070.00516.97
7.2.50.0070.00717.05
7.2.40.0060.00716.99
7.2.30.0040.00716.73
7.2.20.0050.01216.96
7.2.10.0080.00917.01
7.2.00.0050.00716.89
7.1.330.0050.01015.73
7.1.320.0090.00315.77
7.1.310.0030.00715.96
7.1.300.0040.00915.89
7.1.290.0050.00715.80
7.1.280.0050.01015.72
7.1.270.0090.00615.85
7.1.260.0040.00915.73
7.1.250.0040.00915.79
7.1.240.0030.01015.74
7.1.230.0000.01615.73
7.1.220.0000.01515.61
7.1.210.0060.00615.69
7.1.200.0030.01015.96
7.1.190.0030.01015.61
7.1.180.0070.00715.82
7.1.170.0130.00315.51
7.1.160.0000.01315.82
7.1.150.0000.01215.84
7.1.140.0090.00915.83
7.1.130.0100.00315.79
7.1.120.0080.00015.98
7.1.110.0040.00715.64
7.1.100.0070.00615.63
7.1.90.0030.00715.68
7.1.80.0030.01015.68
7.1.70.0000.00916.44
7.1.60.0090.00817.80
7.1.50.0050.01216.34
7.1.40.0100.00015.87
7.1.30.0040.00815.88
7.1.20.0000.01015.77
7.1.10.0100.00315.96
7.1.00.0090.03819.16
7.0.330.0110.00415.44
7.0.320.0090.00615.36
7.0.310.0000.01515.22
7.0.300.0060.01015.50
7.0.290.0000.01215.05
7.0.280.0030.01015.30
7.0.270.0000.01315.44
7.0.260.0060.00615.57
7.0.250.0040.00715.22
7.0.240.0030.00715.24
7.0.230.0030.00715.47
7.0.220.0000.01415.42
7.0.210.0060.00315.43
7.0.200.1110.01016.07
7.0.190.0040.00815.36
7.0.180.0040.00815.48
7.0.170.0000.00915.46
7.0.160.0040.01115.40
7.0.150.0040.00715.52
7.0.140.0040.03918.62
7.0.130.0030.01215.29
7.0.120.0040.00415.14
7.0.110.0040.00715.50
7.0.100.0080.00315.41
7.0.90.0100.00315.39
7.0.80.0130.00015.61
7.0.70.0040.01115.70
7.0.60.0050.03417.73
7.0.50.0030.03716.71
7.0.40.0040.02416.79
7.0.30.0150.02516.78
7.0.20.0110.02316.78
7.0.10.0080.04516.87
7.0.00.0070.02516.79
5.6.400.0000.01514.37
5.6.390.0030.00614.63
5.6.380.0100.00614.64
5.6.370.0000.01314.61
5.6.360.0100.00714.66
5.6.350.0070.00714.46
5.6.340.0000.01414.73
5.6.330.0070.00314.39
5.6.320.0040.00814.39
5.6.310.0080.00314.80
5.6.300.0040.00714.22
5.6.290.0000.00914.39
5.6.280.0030.04217.79
5.6.270.0060.00614.60
5.6.260.0070.00714.60
5.6.250.0070.00714.59
5.6.240.0040.01114.77
5.6.230.0080.00414.78
5.6.220.0040.01214.33
5.6.210.0110.04017.67
5.6.200.0050.03316.28
5.6.190.0070.04817.59
5.6.180.1660.02017.54
5.6.170.0180.04217.66
5.6.160.0100.02217.46
5.6.150.0030.02616.27
5.6.140.0080.02316.23
5.6.130.0080.03416.37
5.6.120.0050.04917.73
5.6.110.0080.03017.74
5.6.100.0070.04417.86
5.6.90.0080.04317.88
5.6.80.0050.03417.36
5.6.70.2350.02517.40
5.6.60.0000.00914.32
5.6.50.0030.01014.09
5.6.40.0100.00314.16
5.6.30.0000.01114.36
5.6.20.0060.00614.01
5.6.10.0120.00014.32
5.6.00.0030.01014.25
5.5.380.0000.01514.34
5.5.370.0030.00714.56
5.5.360.0000.01414.41
5.5.350.0210.03317.45
5.5.340.0050.03016.41
5.5.330.0090.04317.24
5.5.320.1560.02317.48
5.5.310.0170.03517.42
5.5.300.0080.04116.24
5.5.290.0040.03016.31
5.5.280.0070.03017.60
5.5.270.0050.04617.62
5.5.260.0090.04217.56
5.5.250.0130.04417.58
5.5.240.0170.03517.34
5.5.230.0030.01014.57
5.5.220.0060.00814.41
5.5.210.0030.00914.30
5.5.200.0000.01414.52
5.5.190.0030.01114.34
5.5.180.0120.00314.36
5.5.170.0090.00614.37
5.5.160.0060.00314.47
5.5.150.0040.01113.98
5.5.140.0040.00414.16
5.5.130.0000.01414.50
5.5.120.0030.00714.08
5.5.110.0060.00314.56
5.5.100.0070.00714.30
5.5.90.0000.01514.49
5.5.80.0070.00714.24
5.5.70.0090.00613.91
5.5.60.0090.00314.17
5.5.50.0110.00414.41
5.5.40.0030.00914.50
5.5.30.0040.01114.55
5.5.20.0060.00614.35
5.5.10.0070.01014.48
5.5.00.0130.00014.09
5.4.450.0200.03215.55
5.4.440.0310.03315.47
5.4.430.0030.04715.37
5.4.420.0080.04015.31
5.4.410.0080.02715.43
5.4.400.0100.02415.15
5.4.390.0050.03114.80
5.4.380.0070.03615.09
5.4.370.0070.03314.95
5.4.360.0150.02814.91
5.4.350.0180.02614.97
5.4.340.0140.02814.82
5.4.330.0000.00711.39
5.4.320.0060.02411.66
5.4.310.0040.02411.79
5.4.300.0070.02511.79
5.4.290.0040.02511.72
5.4.280.0060.02311.79
5.4.270.0140.02514.80
5.4.260.0080.02715.04
5.4.250.0100.03715.04
5.4.240.0100.03314.99
5.4.230.0050.04915.05
5.4.220.0080.03315.02
5.4.210.0100.03514.96
5.4.200.0070.03614.98
5.4.190.0030.03415.00
5.4.180.0120.02914.96
5.4.170.0100.03814.81
5.4.160.0130.03915.06
5.4.150.0050.03814.89
5.4.140.0040.04213.91
5.4.130.0080.03713.97
5.4.120.0080.03813.79
5.4.110.0050.03013.63
5.4.100.0100.02513.91
5.4.90.0000.03313.85
5.4.80.0050.02913.89
5.4.70.0070.04013.69
5.4.60.0180.02613.65
5.4.50.0020.02813.74
5.4.40.0020.03313.85
5.4.30.0060.02713.84
5.4.20.0050.04213.61
5.4.10.0110.02513.80
5.4.00.0140.02913.63
5.3.290.0040.02111.76
5.3.280.0090.02712.54
5.3.270.0020.03412.72
5.3.260.0050.02912.62
5.3.250.0030.03712.57
5.3.240.0080.02912.60
5.3.230.0080.03812.60
5.3.220.0120.02312.62
5.3.210.0030.03712.54
5.3.200.0030.03312.62
5.3.190.0080.02712.62
5.3.180.0070.03012.62
5.3.170.0040.03412.47
5.3.160.0020.04012.56
5.3.150.0070.02712.79
5.3.140.0050.03612.67
5.3.130.0060.03012.73
5.3.120.0030.04312.72
5.3.110.0070.04012.49
5.3.100.0080.02812.37
5.3.90.0120.02712.40
5.3.80.0080.02612.30
5.3.70.0090.02812.27
5.3.60.0080.03112.27
5.3.50.0030.04012.12
5.3.40.0090.02512.21
5.3.30.0060.03412.31
5.3.20.0100.03512.06
5.3.10.0070.02712.08
5.3.00.0070.03611.97
5.2.170.0070.05011.06
5.2.160.0070.05311.38
5.2.150.0070.03711.14
5.2.140.0070.05011.14
5.2.130.0070.04711.19
5.2.120.0100.04011.17
5.2.110.0070.05011.12
5.2.100.0030.05011.20
5.2.90.0170.04711.18
5.2.80.0100.05711.09
5.2.70.0070.05311.01
5.2.60.0130.05011.25
5.2.50.0100.04310.99
5.2.40.0030.05710.97
5.2.30.0070.03711.07
5.2.20.0030.04010.96
5.2.10.0070.04010.86
5.2.00.0070.05310.73
5.1.60.0000.03710.11
5.1.50.0070.0479.99
5.1.40.0070.03310.00
5.1.30.0070.05010.44
5.1.20.0030.04310.45
5.1.10.0070.04010.03
5.1.00.0130.04310.17
5.0.50.0000.0338.54
5.0.40.0100.0208.60
5.0.30.0070.0438.32
5.0.20.0100.0278.29
5.0.10.0000.0338.20
5.0.00.0070.0408.20
4.4.90.0070.0276.12
4.4.80.0030.0236.12
4.4.70.0070.0276.12
4.4.60.0000.0236.12
4.4.50.0000.0236.12
4.4.40.0100.0336.12
4.4.30.0030.0236.12
4.4.20.0030.0206.12
4.4.10.0100.0176.12
4.4.00.0070.0336.12
4.3.110.0000.0236.12
4.3.100.0070.0176.12
4.3.90.0030.0206.12
4.3.80.0030.0476.12
4.3.70.0070.0206.12
4.3.60.0030.0206.12
4.3.50.0000.0306.12
4.3.40.0030.0406.12
4.3.30.0000.0236.12
4.3.20.0000.0306.12
4.3.10.0030.0236.12
4.3.00.0130.0207.38

preferences:
48.57 ms | 401 KiB | 5 Q