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('N*', $str)); $signBit = (bool) ($longs[0] & 0x80000000); $isSigned = (bool) ($flags & INT_SIGNED); if (is32Bit()) { if ($isSigned) { } else { if ($longs[0] & 0x80000000) { $longs[0] = (($longs[0] & 0x7FFFFFFF) * 2) + ~$longs[0] + 1; } if ($longs[1] & 0x80000000) { $longs[1] = (($longs[1] & 0x7FFFFFFF) * 2) + ~$longs[1] + 1; } $result = ($longs[0] * pow(2, 32)) + $longs[1]; } } else { $result = ($longs[0] << 32) | $longs[1]; if ($signBit && !$isSigned) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } return $result; } printf('%f', unpack_int64("\x80\x00\x00\x07\xFF\xFF\xFF\xFF", INT_SIGNED));

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.0140.00718.31
8.3.50.0120.00821.21
8.3.40.0090.00618.85
8.3.30.0080.00818.62
8.3.20.0080.00018.68
8.3.10.0040.00420.66
8.3.00.0070.00317.63
8.2.180.0150.00316.50
8.2.170.0170.00322.96
8.2.160.0100.00322.11
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00419.89
8.2.110.0080.00320.90
8.2.100.0080.00417.78
8.2.90.0040.00419.40
8.2.80.0040.00417.97
8.2.70.0080.00017.62
8.2.60.0080.00017.93
8.2.50.0040.00418.07
8.2.40.0040.00418.03
8.2.30.0080.00019.79
8.2.20.0000.00717.63
8.2.10.0000.00717.77
8.2.00.0030.00617.80
8.1.280.0090.00625.92
8.1.270.0040.00423.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0230.00022.46
8.1.230.0090.00320.90
8.1.220.0060.00318.77
8.1.210.0060.00318.97
8.1.200.0000.00917.25
8.1.190.0040.00417.54
8.1.180.0000.00918.10
8.1.170.0080.00018.84
8.1.160.0040.00418.96
8.1.150.0070.00018.61
8.1.140.0040.00417.48
8.1.130.0080.00017.95
8.1.120.0000.00717.48
8.1.110.0030.00517.41
8.1.100.0030.00517.46
8.1.90.0070.00017.47
8.1.80.0000.00817.48
8.1.70.0000.00717.50
8.1.60.0040.00417.60
8.1.50.0050.00317.41
8.1.40.0030.00617.62
8.1.30.0030.00617.55
8.1.20.0000.00817.69
8.1.10.0000.00817.56
8.1.00.0060.00317.41
8.0.300.0030.00620.03
8.0.290.0000.00918.49
8.0.280.0070.00018.38
8.0.270.0050.00217.24
8.0.260.0000.00718.61
8.0.250.0000.00717.00
8.0.240.0030.00616.95
8.0.230.0070.00016.86
8.0.220.0030.00616.89
8.0.210.0000.00716.99
8.0.200.0000.00716.97
8.0.190.0050.00316.88
8.0.180.0020.00516.98
8.0.170.0000.00916.92
8.0.160.0040.00316.95
8.0.150.0030.00616.89
8.0.140.0030.01016.78
8.0.130.0030.00313.32
8.0.120.0000.00816.71
8.0.110.0030.00616.87
8.0.100.0070.00016.71
8.0.90.0040.00416.92
8.0.80.0060.01016.87
8.0.70.0000.00716.87
8.0.60.0040.00416.94
8.0.50.0040.00416.79
8.0.30.0130.00717.17
8.0.20.0090.01017.40
8.0.10.0040.00416.98
8.0.00.0100.00816.99
7.4.330.0030.00313.43
7.4.320.0000.00616.53
7.4.300.0000.00616.52
7.4.290.0000.00716.55
7.4.280.0070.00016.63
7.4.270.0030.00316.68
7.4.260.0030.00313.30
7.4.250.0040.00416.59
7.4.240.0040.00316.45
7.4.230.0000.00716.37
7.4.220.0120.00616.67
7.4.210.0120.00416.69
7.4.200.0000.00716.28
7.4.190.0000.00716.60
7.4.160.0030.01316.61
7.4.150.0110.00617.40
7.4.140.0050.01217.19
7.4.130.0080.00916.55
7.4.120.0050.01316.53
7.4.110.0060.01216.43
7.4.100.0120.00616.38
7.4.90.0100.00616.41
7.4.80.0100.01019.03
7.4.70.0100.01216.68
7.4.60.0130.00616.48
7.4.50.0040.00416.32
7.4.40.0090.00622.27
7.4.30.0070.01016.54
7.4.00.0000.01114.84
7.3.330.0050.00013.34
7.3.320.0000.00513.19
7.3.310.0000.00716.43
7.3.300.0000.00616.35
7.3.290.0040.01116.44
7.3.280.0110.00516.39
7.3.270.0130.00417.40
7.3.260.0100.01418.24
7.3.250.0080.01016.54
7.3.240.0110.00616.70
7.3.230.0040.01316.39
7.3.210.0120.00416.68
7.3.200.0090.00919.39
7.3.190.0120.00616.40
7.3.180.0140.00316.65
7.3.170.0030.01516.66
7.3.160.0060.01016.27
7.3.120.0040.01514.74
7.3.110.0060.01314.50
7.3.100.0030.01315.16
7.3.90.0030.00714.66
7.3.80.0070.00714.85
7.3.70.0060.01214.89
7.3.60.0060.00614.66
7.3.50.0000.01014.93
7.3.40.0100.00714.98
7.3.30.0030.00614.65
7.3.20.0030.01116.77
7.3.10.0040.01116.46
7.3.00.0070.00716.73
7.2.330.0100.01316.47
7.2.320.0080.00816.76
7.2.310.0140.00616.63
7.2.300.0100.01316.43
7.2.290.0160.00616.55
7.2.240.0000.01715.23
7.2.230.0060.00915.21
7.2.220.0140.00314.95
7.2.210.0150.00014.76
7.2.200.0000.01114.90
7.2.190.0040.00715.15
7.2.180.0130.00315.03
7.2.170.0060.00615.16
7.2.160.0030.01015.22
7.2.150.0040.01116.77
7.2.140.0080.00717.03
7.2.130.0100.00617.00
7.2.120.0030.01016.54
7.2.110.0000.01216.88
7.2.100.0070.00717.01
7.2.90.0040.01116.88
7.2.80.0060.01017.06
7.2.70.0030.01117.02
7.2.60.0090.00616.94
7.2.50.0070.00716.82
7.2.40.0110.00716.96
7.2.30.0000.01717.00
7.2.20.0060.00616.65
7.2.10.0100.00716.72
7.2.00.0050.00817.98
7.1.330.0070.01015.75
7.1.320.0000.01215.63
7.1.310.0040.01115.71
7.1.300.0120.00315.98
7.1.290.0150.00016.00
7.1.280.0090.00615.90
7.1.270.0030.00915.79
7.1.260.0040.00815.88
7.1.250.0090.00615.53
7.1.100.0070.00718.14
7.1.70.0030.00516.89
7.1.60.0110.00719.40
7.1.50.0100.01316.92
7.1.00.0030.06022.46
7.0.200.0160.00716.33
7.0.140.0100.06721.95
7.0.60.0130.08020.08
7.0.50.0130.07717.88
7.0.40.0070.08017.72
7.0.30.0030.06717.80
7.0.20.0070.05317.86
7.0.10.0100.04317.80
7.0.00.0100.04317.72
5.6.280.0030.07320.94
5.6.210.0130.07320.61
5.6.200.0100.05018.16
5.6.190.0100.06718.30
5.6.180.0100.07318.18
5.6.170.0070.08318.24
5.6.160.0070.04018.29
5.6.150.0000.04318.18
5.6.140.0030.04018.18
5.6.130.0000.04318.14
5.6.120.0030.06018.18
5.6.110.0000.04318.24
5.6.100.0000.04318.20
5.6.90.0000.04318.25
5.6.80.0030.04017.59
5.6.70.0070.03717.56
5.6.60.0200.03017.65
5.6.50.0030.04017.53
5.6.40.0100.04017.55
5.6.30.0000.04017.56
5.6.20.0030.03717.54
5.6.10.0070.03317.57
5.6.00.0030.03717.49
5.5.350.3070.03020.54
5.5.340.0130.07317.98
5.5.330.0070.07718.05
5.5.320.0170.07017.98
5.5.310.0070.07717.98
5.5.300.0000.04317.98
5.5.290.0000.04317.98
5.5.280.0000.05317.95
5.5.270.0000.04718.06
5.5.260.0070.03718.02
5.5.250.0030.04017.77
5.5.240.0100.03317.46
5.5.230.0070.03317.43
5.5.220.0030.03717.38
5.5.210.0130.03717.43
5.5.200.0000.04017.41
5.5.190.0100.03017.37
5.5.180.0000.04017.34
5.5.160.0030.03717.31
5.5.150.0070.03317.42
5.5.140.0030.03717.29
5.5.130.0000.04017.39
5.5.120.0000.05317.34
5.5.110.0030.04717.33
5.5.100.0030.05017.21
5.5.90.0100.07317.31
5.5.80.0030.08317.21
5.5.70.0000.07317.22
5.5.60.0030.04717.23
5.5.50.0070.05017.20
5.5.40.0130.05317.18
5.5.30.0100.07717.22
5.5.20.0030.05017.18
5.5.10.0070.07717.32
5.5.00.0130.07317.25
5.4.450.0070.03719.36
5.4.440.0000.04319.34
5.4.430.0070.03319.42
5.4.420.0070.03319.34
5.4.410.0030.04019.32
5.4.400.0030.03719.04
5.4.390.0000.04019.02
5.4.380.0100.03318.95
5.4.370.0000.04019.13
5.4.360.0100.03019.05
5.4.350.0100.03018.96
5.4.340.0070.03319.03
5.4.320.0070.03718.96
5.4.310.0100.03019.12
5.4.300.0070.03318.89
5.4.290.0100.03019.05
5.4.280.0070.04019.02
5.4.270.0000.05018.95
5.4.260.0100.07019.17
5.4.250.0000.07018.96
5.4.240.0070.04318.97
5.4.230.0000.06718.88
5.4.220.0170.02719.04
5.4.210.0130.05318.98
5.4.200.0070.05319.04
5.4.190.0070.06019.00
5.4.180.0100.06719.01
5.4.170.0030.06719.08
5.4.160.0100.04018.86
5.4.150.0030.08019.02
5.4.140.0130.04716.43
5.4.130.0130.07016.43
5.4.120.0030.07016.62
5.4.110.0030.08016.42
5.4.100.0070.07316.45
5.4.90.0070.04016.50
5.4.80.0130.04016.56
5.4.70.0000.07716.52
5.4.60.0130.05316.23
5.4.50.0070.04016.45
5.4.40.0130.05716.37
5.4.30.0070.07016.52
5.4.20.0070.07016.39
5.4.10.0070.06716.39
5.4.00.0030.04315.85
5.3.290.0000.04014.69
5.3.280.0070.03714.72
5.3.270.0070.05314.68
5.3.260.0070.08014.68
5.3.250.0070.04314.66
5.3.240.0100.06714.67
5.3.230.0070.08014.61
5.3.220.0030.08014.64
5.3.210.0170.06714.55
5.3.200.0070.08314.63
5.3.190.0130.05314.64
5.3.180.0070.04714.63
5.3.170.0030.07714.63
5.3.160.0030.07714.64
5.3.150.0130.05714.81
5.3.140.0070.05014.57
5.3.130.0030.05314.53
5.3.120.0100.07314.42
5.3.110.0070.06014.60
5.3.100.0030.06014.13
5.3.90.0130.06014.05
5.3.80.0000.05314.25
5.3.70.0030.03714.25
5.3.60.0070.07014.05
5.3.50.0030.06313.96
5.3.40.0070.07313.87
5.3.30.0030.07713.99
5.3.20.0070.05713.75
5.3.10.0070.05313.52
5.3.00.0030.04313.66
5.2.170.0000.06711.21
5.2.160.0070.04311.38
5.2.150.0170.05011.19
5.2.140.0000.06711.21
5.2.130.0070.06011.16
5.2.120.0030.04311.20
5.2.110.0070.04311.13
5.2.100.0070.02711.18
5.2.90.0070.05711.15
5.2.80.0030.06311.19
5.2.70.0100.05711.12
5.2.60.0000.04011.11
5.2.50.0070.04311.26
5.2.40.0000.05710.95
5.2.30.0000.06011.21
5.2.20.0070.06011.04
5.2.10.0000.06310.70
5.2.00.0070.05710.73
5.1.60.0070.05010.07
5.1.50.0070.05310.07
5.1.40.0070.05010.14
5.1.30.0030.04010.48
5.1.20.0000.05710.43
5.1.10.0000.03010.10
5.1.00.0070.04010.21
5.0.50.0030.0238.71
5.0.40.0000.0508.55
5.0.30.0070.0608.16
5.0.20.0000.0378.37
5.0.10.0030.0238.33
5.0.00.0030.0608.33
4.4.90.0070.0237.55
4.4.80.0030.0337.55
4.4.70.0070.0337.55
4.4.60.0070.0337.55
4.4.50.0000.0277.55
4.4.40.0030.0407.55
4.4.30.0030.0377.55
4.4.20.0030.0237.55
4.4.10.0000.0377.55
4.4.00.0000.0607.55
4.3.110.0000.0407.55
4.3.100.0000.0407.55
4.3.90.0000.0337.55
4.3.80.0070.0437.55
4.3.70.0000.0377.55
4.3.60.0000.0237.55
4.3.50.0070.0337.55
4.3.40.0000.0307.55
4.3.30.0000.0377.55
4.3.20.0070.0237.55
4.3.10.0030.0337.55
4.3.00.0030.0337.55

preferences:
58.28 ms | 401 KiB | 5 Q