3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('INT_SIGNED', 1); define('INT_LE', 2); function is32Bit() { $test = unpack('N', "\xFF\xFF\xFF\xFF"); return current($test) === -1; } function unpack_int32($str, $flags = 0) { $length = strlen($str); if ($length < 4) { return false; } else if ($length > 4) { $str = substr($str, 0, 4); } if ($flags & INT_LE) { $str = strrev($str); } $result = unpack('N', $str); $result = current($result); $signBit = (bool) ($result & 0x80000000); $isSigned = (bool) ($flags & INT_SIGNED); $is32bit = is32Bit(); if ($signBit && $isSigned && !$is32bit) { $result = (0x00000000FFFFFFFF << 32) | $result; } else if ($signBit && !$isSigned && $is32bit) { $result = (($result & 0x7FFFFFFF) * 2) + ~$result + 1; } return $result; } function unpack_int64($str, $flags = 0) { $length = strlen($str); if ($length < 8) { return false; } else if ($length > 8) { $str = substr($str, 0, 8); } if ($flags & INT_LE) { $str = strrev($str); } $longs = array_values(unpack('NN', substr($str, 0, 4), substr($str, 4, 4))); $signBit = (bool) ($longs[0] & 0x80000000); if (!is32Bit()) { $result = ($longs[0] << 32) | $longs[1]; if ($signBit) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } return $result; } var_dump(unpack_int32("\x81\x00\x00\x80", INT_SIGNED | INT_LE));

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.0070.01318.31
8.3.50.0130.00721.90
8.3.40.0140.00718.73
8.3.30.0070.01019.14
8.3.20.0040.00420.16
8.3.10.0040.00421.95
8.3.00.0080.00022.39
8.2.180.0150.00318.17
8.2.170.0100.00722.96
8.2.160.0130.00620.81
8.2.150.0060.00324.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0060.00319.38
8.2.110.0030.00620.52
8.2.100.0120.00017.91
8.2.90.0040.00419.08
8.2.80.0040.00417.97
8.2.70.0060.00617.50
8.2.60.0000.00917.80
8.2.50.0040.00418.07
8.2.40.0040.00418.22
8.2.30.0040.00418.02
8.2.20.0000.00717.71
8.2.10.0020.00517.69
8.2.00.0000.00717.66
8.1.280.0070.01025.92
8.1.270.0040.00423.77
8.1.260.0000.00926.35
8.1.250.0080.00028.09
8.1.240.0070.00323.78
8.1.230.0040.00823.91
8.1.220.0080.00017.78
8.1.210.0030.00518.77
8.1.200.0030.00717.35
8.1.190.0040.00417.38
8.1.180.0080.00018.10
8.1.170.0040.00418.50
8.1.160.0040.00421.99
8.1.150.0050.00318.72
8.1.140.0030.00517.39
8.1.130.0000.00717.77
8.1.120.0000.00717.49
8.1.110.0000.00717.49
8.1.100.0000.00717.48
8.1.90.0040.00417.48
8.1.80.0000.00817.49
8.1.70.0070.00017.45
8.1.60.0060.00317.59
8.1.50.0000.00717.55
8.1.40.0000.00717.55
8.1.30.0040.00417.70
8.1.20.0000.00817.62
8.1.10.0070.00017.48
8.1.00.0030.00617.37
8.0.300.0040.00418.77
8.0.290.0040.00417.18
8.0.280.0030.00318.40
8.0.270.0030.00317.18
8.0.260.0030.00316.95
8.0.250.0070.00016.91
8.0.240.0000.00717.00
8.0.230.0000.00716.99
8.0.220.0000.00816.93
8.0.210.0000.00716.86
8.0.200.0000.00716.96
8.0.190.0000.00816.98
8.0.180.0000.00817.00
8.0.170.0040.00416.84
8.0.160.0050.00316.84
8.0.150.0000.00816.94
8.0.140.0040.00416.87
8.0.130.0000.00613.37
8.0.120.0030.00616.86
8.0.110.0020.00516.95
8.0.100.0040.00416.91
8.0.90.0000.00716.91
8.0.80.0000.01516.92
8.0.70.0000.00816.90
8.0.60.0040.00416.89
8.0.50.0050.00316.78
8.0.30.0130.00817.16
8.0.20.0100.01017.43
8.0.10.0030.00517.00
8.0.00.0050.01216.77
7.4.330.0030.00315.09
7.4.320.0030.00316.56
7.4.300.0000.00716.64
7.4.290.0000.00816.49
7.4.280.0000.00716.51
7.4.270.0080.00316.47
7.4.260.0040.00416.48
7.4.250.0000.00716.59
7.4.240.0000.00716.58
7.4.230.0030.00316.64
7.4.220.0080.00816.72
7.4.210.0040.01016.55
7.4.200.0050.00316.58
7.4.190.0040.00416.80
7.4.160.0060.01116.53
7.4.150.0170.00317.40
7.4.140.0160.00317.86
7.4.130.0120.00516.71
7.4.120.0100.00716.63
7.4.110.0130.00616.59
7.4.100.0090.01816.59
7.4.90.0040.01816.63
7.4.80.0070.01019.39
7.4.70.0070.01316.60
7.4.60.0090.00616.65
7.4.50.0000.00416.68
7.4.40.0100.00722.77
7.4.30.0030.01416.45
7.4.10.0130.00614.95
7.4.00.0070.00814.91
7.3.330.0060.00013.20
7.3.320.0020.00213.38
7.3.310.0040.00416.37
7.3.300.0030.00316.43
7.3.290.0060.01516.36
7.3.280.0100.00616.37
7.3.270.0090.00917.40
7.3.260.0130.01316.38
7.3.250.0100.00716.58
7.3.240.0100.00716.49
7.3.230.0070.01016.65
7.3.210.0140.00816.44
7.3.200.0030.01419.39
7.3.190.0060.01116.67
7.3.180.0100.00716.67
7.3.170.0080.00816.38
7.3.160.0120.01016.57
7.3.130.0070.01114.88
7.3.120.0090.00514.90
7.3.110.0090.00614.94
7.3.100.0030.01414.93
7.3.90.0130.00314.88
7.3.80.0060.00614.59
7.3.70.0000.01514.82
7.3.60.0080.00814.78
7.3.50.0060.00914.90
7.3.40.0090.00314.89
7.3.30.0090.00614.81
7.3.20.0110.00316.72
7.3.10.0030.01216.58
7.3.00.0070.00716.89
7.2.330.0070.01016.67
7.2.320.0060.01416.58
7.2.310.0100.00716.66
7.2.300.0080.00816.46
7.2.290.0030.01316.71
7.2.260.0090.00915.01
7.2.250.0100.01015.07
7.2.240.0100.00715.27
7.2.230.0090.00914.98
7.2.220.0040.00715.21
7.2.210.0000.00915.00
7.2.200.0030.00615.07
7.2.190.0100.00715.14
7.2.180.0060.00315.04
7.2.170.0070.00715.11
7.2.160.0070.01015.07
7.2.150.0100.00716.89
7.2.140.0080.00316.78
7.2.130.0160.00016.86
7.2.120.0030.01016.78
7.2.110.0030.01216.74
7.2.100.0070.01016.66
7.2.90.0060.00916.64
7.2.80.0090.00617.02
7.2.70.0120.00316.91
7.2.60.0100.00716.93
7.2.50.0060.00917.05
7.2.40.0030.01017.05
7.2.30.0090.00316.82
7.2.20.0100.00717.01
7.2.10.0060.00917.01
7.2.00.0060.00616.93
7.1.330.0120.00615.86
7.1.320.0030.01315.77
7.1.310.0000.01715.71
7.1.300.0000.01315.85
7.1.290.0080.00315.73
7.1.280.0040.01115.82
7.1.270.0090.00615.87
7.1.260.0000.01215.85
7.1.250.0040.00815.97
7.1.240.0060.00915.75
7.1.230.0030.00915.87
7.1.220.0110.00415.60
7.1.210.0070.00715.90
7.1.200.0030.01015.89
7.1.190.0070.00315.70
7.1.180.0050.00615.70
7.1.170.0070.00315.84
7.1.160.0000.01515.56
7.1.150.0110.00315.82
7.1.140.0000.01315.95
7.1.130.0090.00615.71
7.1.120.0080.00315.88
7.1.110.0030.01415.86
7.1.100.0000.01715.85
7.1.90.0090.00315.93
7.1.80.0080.00015.89
7.1.70.0010.00716.49
7.1.60.0030.01016.52
7.1.50.0120.01325.21
7.1.40.0030.00615.66
7.1.30.0060.00615.63
7.1.20.0000.00815.85
7.1.10.0050.00815.96
7.1.00.0030.04219.15
7.0.330.0070.00715.51
7.0.320.0030.00715.37
7.0.310.0040.00815.43
7.0.300.0040.00715.52
7.0.290.0000.01115.57
7.0.280.0000.01715.37
7.0.270.0080.00615.59
7.0.260.0070.00315.65
7.0.250.0090.00315.36
7.0.240.0140.00015.43
7.0.230.0060.00615.63
7.0.220.0030.01015.38
7.0.210.0000.01215.58
7.0.200.0050.00816.06
7.0.190.0000.01215.50
7.0.180.0080.00015.51
7.0.170.0060.00915.32
7.0.160.0000.00915.61
7.0.150.0080.00415.30
7.0.140.0080.03718.70
7.0.130.0000.01015.32
7.0.120.0030.00715.61
7.0.110.0000.01415.17
7.0.100.0080.03017.71
7.0.90.0060.02717.78
7.0.80.0020.02617.78
7.0.70.0070.02717.75
7.0.60.0130.04517.66
7.0.50.0050.03517.95
7.0.40.0060.04516.62
7.0.30.0120.04216.83
7.0.20.0030.03716.65
7.0.10.0060.02116.78
7.0.00.0080.02816.81
5.6.400.0090.00014.60
5.6.390.0070.00714.61
5.6.380.0070.01014.73
5.6.370.0100.00313.99
5.6.360.0030.00614.47
5.6.350.0080.00814.54
5.6.340.0100.00014.33
5.6.330.0030.01014.13
5.6.320.0110.00314.33
5.6.310.0030.01214.52
5.6.300.0040.00414.50
5.6.290.0070.01014.32
5.6.280.0040.01114.37
5.6.270.0000.01314.51
5.6.260.0050.00514.51
5.6.250.0050.02617.54
5.6.240.0080.02517.59
5.6.230.0030.03017.43
5.6.220.0030.02717.54
5.6.210.0050.02517.53
5.6.200.0050.02417.83
5.6.190.0070.03817.79
5.6.180.0070.03217.68
5.6.170.0120.03417.80
5.6.160.0070.02517.66
5.6.150.0050.03317.70
5.6.140.0080.04017.75
5.6.130.0080.03817.62
5.6.120.0030.02817.66
5.6.110.0110.04417.65
5.6.100.0120.02517.82
5.6.90.0070.03717.61
5.6.80.0060.02517.32
5.6.70.0020.03317.41
5.6.60.0040.04517.40
5.6.50.0060.02617.41
5.6.40.0050.04217.31
5.6.30.0150.03217.38
5.6.20.0070.02217.35
5.6.10.0050.04117.45
5.6.00.0080.03917.20
5.5.380.0050.03717.47
5.5.370.0100.04417.49
5.5.360.0070.02717.39
5.5.350.0060.03317.44
5.5.340.0020.02617.56
5.5.330.0090.03417.63
5.5.320.0060.02117.55
5.5.310.0070.02517.57
5.5.300.0080.02017.43
5.5.290.0050.02617.44
5.5.280.0030.04517.44
5.5.270.0100.03517.61
5.5.260.0100.04217.64
5.5.250.0080.03617.52
5.5.240.0110.03517.24
5.5.230.0060.02217.12
5.5.220.0070.02417.27
5.5.210.0080.02417.36
5.5.200.0120.03517.17
5.5.190.0030.05017.09
5.5.180.0080.04117.38
5.5.170.0000.01514.40
5.5.160.0120.02717.28
5.5.150.0030.04017.16
5.5.140.0030.04717.18
5.5.130.0070.02317.08
5.5.120.0050.02717.08
5.5.110.0060.02617.17
5.5.100.0080.04017.09
5.5.90.0050.04417.28
5.5.80.0100.04117.09
5.5.70.0030.03616.97
5.5.60.0150.02517.13
5.5.50.0010.02817.27
5.5.40.0070.02517.08
5.5.30.0070.04117.10
5.5.20.0120.04017.26
5.5.10.0050.04117.21
5.5.00.0030.03817.18
5.4.450.0020.03116.14
5.4.440.0060.04016.13
5.4.430.0050.03316.07
5.4.420.0050.04316.00
5.4.410.0070.02316.11
5.4.400.0040.03716.04
5.4.390.0050.02015.82
5.4.380.0020.03515.83
5.4.370.0020.02215.92
5.4.360.0120.03015.84
5.4.350.0050.03715.89
5.4.340.0080.03415.91
5.4.330.0080.00312.79
5.4.320.0150.03515.91
5.4.310.0090.03115.97
5.4.300.0050.02515.96
5.4.290.0030.04715.84
5.4.280.0050.04015.99
5.4.270.0030.04516.01
5.4.260.0050.04515.91
5.4.250.0020.04215.99
5.4.240.0060.03716.00
5.4.230.0030.03215.91
5.4.220.0070.03815.91
5.4.210.0070.02515.95
5.4.200.0050.02315.99
5.4.190.0020.04715.81
5.4.180.0070.04215.98
5.4.170.0070.03915.90
5.4.160.0030.02715.85
5.4.150.0050.03715.99
5.4.140.0070.02714.64
5.4.130.0030.02414.64
5.4.120.0050.03014.54
5.4.110.0050.02314.63
5.4.100.0120.03014.67
5.4.90.0050.03314.59
5.4.80.0070.03314.67
5.4.70.0080.02014.65
5.4.60.0060.02314.66
5.4.50.0050.02014.56
5.4.40.0050.02314.60
5.4.30.0030.03714.64
5.4.20.0070.02614.63
5.4.10.0050.02214.60
5.4.00.0080.03514.24
5.3.290.0030.03713.76
5.3.280.0030.02313.76
5.3.270.0050.04013.71
5.3.260.0070.04013.70
5.3.250.0070.03713.68
5.3.240.0100.03813.73
5.3.230.0040.02113.75
5.3.220.0100.03413.68
5.3.210.0070.03213.74
5.3.200.0030.02713.68
5.3.190.0050.03113.75
5.3.180.0050.03513.71
5.3.170.0050.02813.73
5.3.160.0030.03713.71
5.3.150.0070.03513.67
5.3.140.0000.02713.67
5.3.130.0070.02113.66
5.3.120.0020.03013.66
5.3.110.0050.04013.68
5.3.100.0030.04313.41
5.3.90.0030.04513.44
5.3.80.0030.03013.36
5.3.70.0070.02013.44
5.3.60.0050.04013.46
5.3.50.0050.04313.42
5.3.40.0050.04313.39
5.3.30.0030.04013.36
5.3.20.0080.03613.24
5.3.10.0030.03613.30
5.3.00.0050.04013.19
5.2.170.0070.03711.09
5.2.160.0070.05311.27
5.2.150.0130.05711.21
5.2.140.0130.05710.98
5.2.130.0030.06311.17
5.2.120.0030.03711.13
5.2.110.0070.03310.98
5.2.100.0230.04311.03
5.2.90.0000.06311.15
5.2.80.0070.05311.10
5.2.70.0030.06311.04
5.2.60.0000.06311.10
5.2.50.0070.06010.96
5.2.40.0130.04711.04
5.2.30.0100.05010.99
5.2.20.0070.05711.13
5.2.10.0030.03311.00
5.2.00.0070.03710.80
5.1.60.0070.04010.48
5.1.50.0000.05010.48
5.1.40.0070.05010.48
5.1.30.0100.05310.48
5.1.20.0100.04710.48
5.1.10.0130.05010.48
5.1.00.0070.02710.48
5.0.50.0100.02310.48
5.0.40.0000.02310.48
5.0.30.0000.04010.48
5.0.20.0030.03710.48
5.0.10.0030.03310.48
5.0.00.0030.05710.48
4.4.90.0000.02010.48
4.4.80.0070.03010.48
4.4.70.0000.02710.48
4.4.60.0030.02010.48
4.4.50.0000.03710.48
4.4.40.0000.05710.48
4.4.30.0030.01710.48
4.4.20.0070.03310.48
4.4.10.0030.03310.48
4.4.00.0000.03310.48
4.3.110.0000.01710.48
4.3.100.0000.01710.48
4.3.90.0030.03310.48
4.3.80.0070.03010.48
4.3.70.0000.02010.48
4.3.60.0000.03710.48
4.3.50.0000.03010.48
4.3.40.0000.05310.48
4.3.30.0000.03010.48
4.3.20.0000.03010.48
4.3.10.0030.02010.48
4.3.00.0000.02310.48

preferences:
49.7 ms | 401 KiB | 5 Q