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); printf("%08b|%08b\n", $left, $right); $output[$i] = chr($left | $right); } } //0b000100010001000100000000; string_shift_left("\x11\x11\x00", 2, 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.31
8.3.50.0110.00422.06
8.3.40.0070.00718.80
8.3.30.0110.00419.22
8.3.20.0000.00820.34
8.3.10.0030.00521.95
8.3.00.0040.00422.36
8.2.180.0150.00616.88
8.2.170.0040.01122.96
8.2.160.0120.00320.55
8.2.150.0090.00024.18
8.2.140.0040.00424.66
8.2.130.0030.00526.16
8.2.120.0050.00519.26
8.2.110.0090.00021.97
8.2.100.0080.00418.03
8.2.90.0030.00519.30
8.2.80.0000.00818.03
8.2.70.0000.00817.63
8.2.60.0090.00018.00
8.2.50.0050.00318.07
8.2.40.0080.00018.22
8.2.30.0090.00018.11
8.2.20.0050.00317.61
8.2.10.0000.00817.87
8.2.00.0030.00517.68
8.1.280.0040.01125.92
8.1.270.0030.00522.05
8.1.260.0000.00726.35
8.1.250.0080.00028.09
8.1.240.0000.00824.04
8.1.230.0090.00319.16
8.1.220.0040.00417.74
8.1.210.0060.00318.77
8.1.200.0100.00017.22
8.1.190.0050.00317.53
8.1.180.0040.00418.10
8.1.170.0000.00818.71
8.1.160.0040.00421.96
8.1.150.0000.00818.54
8.1.140.0060.00317.48
8.1.130.0030.00317.83
8.1.120.0070.00017.39
8.1.110.0040.00417.48
8.1.100.0040.00417.51
8.1.90.0030.00417.48
8.1.80.0000.00717.54
8.1.70.0000.00717.41
8.1.60.0050.00317.59
8.1.50.0070.00017.42
8.1.40.0030.00617.53
8.1.30.0040.00417.65
8.1.20.0060.00317.68
8.1.10.0030.00517.59
8.1.00.0050.00317.52
8.0.300.0040.00418.77
8.0.290.0050.00317.30
8.0.280.0000.00718.47
8.0.270.0000.00717.33
8.0.260.0030.00516.76
8.0.250.0070.00017.04
8.0.240.0000.00716.87
8.0.230.0000.00717.00
8.0.220.0000.00816.87
8.0.210.0030.00316.75
8.0.200.0030.00316.84
8.0.190.0040.00416.91
8.0.180.0050.00316.92
8.0.170.0000.00817.00
8.0.160.0060.00316.97
8.0.150.0000.00716.88
8.0.140.0000.00716.73
8.0.130.0000.00613.34
8.0.120.0000.00716.91
8.0.110.0000.00716.88
8.0.100.0040.00416.72
8.0.90.0050.00216.96
8.0.80.0070.02116.91
8.0.70.0000.00716.75
8.0.60.0000.00816.82
8.0.50.0040.00416.90
8.0.30.0130.01117.32
8.0.20.0140.00517.40
8.0.10.0070.00017.05
8.0.00.0130.00616.80
7.4.330.0030.00515.01
7.4.320.0000.00716.55
7.4.300.0060.00016.47
7.4.290.0040.00416.57
7.4.280.0000.00716.52
7.4.270.0030.00316.54
7.4.260.0030.00316.49
7.4.250.0030.00316.50
7.4.240.0040.00316.47
7.4.230.0070.00016.70
7.4.220.0130.01016.71
7.4.210.0030.01316.52
7.4.200.0000.00716.52
7.4.190.0000.00816.73
7.4.160.0090.01316.57
7.4.150.0140.00317.40
7.4.140.0140.00617.86
7.4.130.0070.01116.55
7.4.120.0140.00316.52
7.4.110.0090.00916.45
7.4.100.0030.01416.59
7.4.90.0060.01216.43
7.4.80.0070.01019.39
7.4.70.0030.01316.50
7.4.60.0100.00716.58
7.4.50.0000.00816.51
7.4.40.0070.00722.77
7.4.30.0080.00816.68
7.4.00.0040.01514.93
7.3.330.0030.00313.25
7.3.320.0030.00313.39
7.3.310.0000.00916.42
7.3.300.0000.00616.24
7.3.290.0040.01116.39
7.3.280.0110.00816.35
7.3.270.0100.00717.40
7.3.260.0130.00316.37
7.3.250.0120.00916.35
7.3.240.0100.01016.35
7.3.230.0070.02216.66
7.3.210.0080.01516.45
7.3.200.0030.01319.39
7.3.190.0090.00916.43
7.3.180.0110.00516.46
7.3.170.0040.01216.61
7.3.160.0150.00016.45
7.3.120.0100.00314.89
7.3.00.0030.01016.67
7.2.330.0180.00016.79
7.2.320.0090.01516.63
7.2.310.0040.01916.48
7.2.300.0090.00616.70
7.2.290.0030.01716.64
7.2.130.0100.00716.69
7.2.120.0070.01116.85
7.2.110.0070.01016.74
7.2.100.0030.00717.03
7.2.90.0000.01116.89
7.2.80.0070.00717.00
7.2.70.0040.00817.03
7.2.60.0040.01217.02
7.2.50.0110.00316.95
7.2.40.0080.00816.91
7.2.30.0030.00716.74
7.2.20.0090.00617.01
7.2.10.0040.01117.01
7.2.00.0110.00716.84
7.1.250.0120.00315.80
7.1.240.0000.00915.39
7.1.230.0080.00815.79
7.1.220.0070.01115.69
7.1.210.0070.00715.91
7.1.200.0070.01115.93
7.1.190.0060.01015.72
7.1.180.0090.00315.81
7.1.170.0110.00415.73
7.1.160.0070.00715.83
7.1.150.0140.00415.98
7.1.140.0030.00615.88
7.1.130.0120.00915.90
7.1.120.0100.00715.74
7.1.110.0120.00915.57
7.1.100.0080.00617.19
7.1.90.0090.00615.50
7.1.80.0120.00015.48
7.1.70.0020.00716.47
7.1.60.0070.01117.76
7.1.50.0070.00816.35
7.1.40.0130.00315.85
7.1.30.0110.00415.67
7.1.20.0030.00615.68
7.1.10.0070.00315.80
7.1.00.0070.04019.06
7.0.330.0070.00715.32
7.0.320.0050.00515.36
7.0.310.0070.01015.29
7.0.300.0000.01215.07
7.0.290.0070.00715.20
7.0.280.0030.01315.52
7.0.270.0110.00315.25
7.0.260.0040.01415.19
7.0.250.0090.00915.25
7.0.240.0030.01015.38
7.0.230.0000.01015.17
7.0.220.0150.00415.45
7.0.210.0030.00915.14
7.0.200.0080.00616.02
7.0.190.0060.00615.22
7.0.180.0060.00915.30
7.0.170.0030.00715.05
7.0.160.0060.00615.45
7.0.150.0070.00715.27
7.0.140.0040.03818.78
7.0.130.0060.00615.19
7.0.120.0030.01015.52
7.0.110.0090.00315.27
7.0.100.0110.00315.28
7.0.90.0090.00615.39
7.0.80.0000.01515.30
7.0.70.0030.00615.13
7.0.60.0050.02317.59
7.0.50.0030.02816.74
7.0.40.0050.04616.85
7.0.30.0160.02816.96
7.0.20.0180.04016.77
7.0.10.0100.03016.74
7.0.00.0080.03816.85
5.6.380.0040.01114.77
5.6.370.0080.00614.29
5.6.360.0070.00714.75
5.6.350.0090.00614.48
5.6.340.0030.01014.63
5.6.330.0070.00714.54
5.6.320.0100.00314.57
5.6.310.0100.00313.96
5.6.300.0110.00414.11
5.6.290.0030.01314.16
5.6.280.0080.03717.58
5.6.270.0030.00914.34
5.6.260.0060.00614.29
5.6.250.0030.00714.10
5.6.240.0070.01014.30
5.6.230.0030.00614.45
5.6.220.0100.00714.36
5.6.210.0080.04317.44
5.6.200.0160.03816.16
5.6.190.0050.04617.35
5.6.180.1520.02517.36
5.6.170.0150.02817.39
5.6.160.0070.02717.58
5.6.150.0080.04216.34
5.6.140.0060.04316.02
5.6.130.0060.02816.10
5.6.120.0080.03017.77
5.6.110.0070.03417.73
5.6.100.0080.04317.74
5.6.90.0080.04317.50
5.6.80.0080.03817.31
5.6.70.0160.03717.39
5.6.60.0030.01214.23
5.6.50.0070.00714.13
5.6.40.0060.00614.20
5.6.30.0060.01314.12
5.6.20.0130.01014.15
5.6.10.0030.00914.33
5.6.00.0100.00314.25
5.5.380.0040.00411.18
5.5.370.0070.00311.39
5.5.360.0050.00911.24
5.5.350.0120.02515.79
5.5.340.0030.03014.64
5.5.330.0080.02215.77
5.5.320.0130.04015.76
5.5.310.0150.03615.75
5.5.300.0090.03414.64
5.5.290.0040.02314.70
5.5.280.0070.02216.11
5.5.270.0050.02515.99
5.5.260.0050.05115.99
5.5.250.0130.03815.94
5.5.240.0070.03715.67
5.5.230.0060.00611.18
5.5.220.0060.00011.25
5.5.210.0060.00611.18
5.5.200.0000.01011.18
5.5.190.0130.00311.54
5.5.180.0110.00411.35
5.5.170.0040.00411.25
5.5.160.0080.00511.32
5.5.150.0040.00811.18
5.5.140.0000.01211.29
5.5.130.0000.01211.18
5.5.120.0120.00011.18
5.5.110.0100.00011.18
5.5.100.0070.00011.18
5.5.90.0080.00311.18
5.5.80.0000.01111.29
5.5.70.0040.00911.32
5.5.60.0080.00311.18
5.5.50.0060.00611.18
5.5.40.0000.01511.18
5.5.30.0000.01011.18
5.5.20.0030.00911.33
5.5.10.0030.00711.18
5.5.00.0030.00611.24
5.4.450.1150.02415.38
5.4.440.1100.02315.37
5.4.430.1100.01815.41
5.4.420.0050.03715.28
5.4.410.0050.02615.31
5.4.400.0080.01815.25
5.4.390.0680.01815.12
5.4.380.1190.02015.27
5.4.370.1100.01815.15
5.4.360.1250.02815.20
5.4.350.1060.02115.18
5.4.340.1220.01815.20
5.4.330.0040.00411.30
5.4.320.1080.02415.16
5.4.310.0920.02515.21
5.4.300.1080.02115.13
5.4.290.1100.01715.13
5.4.280.1040.02315.06
5.4.270.1140.02315.20
5.4.260.1050.02015.13
5.4.250.1100.01715.08
5.4.240.1050.02315.09
5.4.230.1040.02315.00
5.4.220.1360.01915.21
5.4.210.1100.02315.12
5.4.200.1100.02015.01
5.4.190.0960.02415.11
5.4.180.1100.02315.18
5.4.170.1220.01715.16
5.4.160.1100.02215.05
5.4.150.1000.02215.18
5.4.140.1260.02013.78
5.4.130.1160.02013.77
5.4.120.1130.02713.76
5.4.110.0080.03313.81
5.4.100.0080.01713.70
5.4.90.0300.02013.77
5.4.80.0700.02413.70
5.4.70.0870.01713.93
5.4.60.1020.02013.77
5.4.50.1030.02313.67
5.4.40.0930.02313.70
5.4.30.1370.02013.85
5.4.20.0910.02813.80
5.4.10.0060.02513.80
5.4.00.0060.02213.55
5.3.290.0550.02113.00
5.3.280.1060.02012.88
5.3.270.0950.02312.94
5.3.260.0900.02312.96
5.3.250.0920.02512.95
5.3.240.0990.02012.89
5.3.230.1210.02412.85
5.3.220.1070.02712.82
5.3.210.0750.02112.83
5.3.200.0900.02212.87
5.3.190.0750.02112.95
5.3.180.0930.02312.95
5.3.170.1010.01812.95
5.3.160.0970.01712.83
5.3.150.0990.01812.83
5.3.140.0850.02412.83
5.3.130.0910.02312.87
5.3.120.0960.01712.85
5.3.110.1200.02112.86
5.3.100.0750.02012.60
5.3.90.0220.02712.59
5.3.80.0130.03812.56
5.3.70.0100.03512.71
5.3.60.0120.03612.57
5.3.50.0120.02312.61
5.3.40.0160.02112.61
5.3.30.0120.02512.57
5.3.20.0100.03812.40
5.3.10.0160.02312.37
5.3.00.0130.03712.48
5.2.170.0120.03211.21
5.2.160.0110.01511.15
5.2.150.0110.01511.21
5.2.140.0070.01911.22
5.2.130.0120.01811.21
5.2.120.0140.01511.22
5.2.110.0160.01611.10
5.2.100.0130.01311.17
5.2.90.0110.02311.17
5.2.80.0090.01711.20
5.2.70.0100.01711.18
5.2.60.0100.03211.16
5.2.50.0080.01711.07
5.2.40.0080.02411.12
5.2.30.0070.01811.04
5.2.20.0100.02111.11
5.2.10.0050.02010.98
5.2.00.0120.02010.92
5.1.60.0080.01310.60
5.1.50.0110.01410.54
5.1.40.0080.01710.54
5.1.30.0070.01710.71
5.1.20.0090.01410.80
5.1.10.0070.01610.74
5.1.00.0110.02810.69
5.0.50.0090.0109.82
5.0.40.0050.0269.80
5.0.30.0080.0209.66
5.0.20.0050.0129.79
5.0.10.0050.0109.72
5.0.00.0070.0159.72
4.4.90.0030.0119.48
4.4.80.0020.0119.48
4.4.70.0030.0109.48
4.4.60.0050.0079.48
4.4.50.0050.0129.48
4.4.40.0080.0139.48
4.4.30.0030.0109.48
4.4.20.0030.0129.48
4.4.10.0030.0109.48
4.4.00.0000.0189.48
4.3.110.0050.0139.48
4.3.100.0030.0129.48
4.3.90.0050.0109.48
4.3.80.0050.0139.48
4.3.70.0020.0129.48
4.3.60.0050.0089.48
4.3.50.0020.0119.48
4.3.40.0080.0189.48
4.3.30.0050.0139.48
4.3.20.0030.0129.48
4.3.10.0020.0159.48
4.3.00.0020.0089.48

preferences:
40.92 ms | 401 KiB | 5 Q