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

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.40.0080.00818.75
8.3.30.0160.00019.27
8.3.20.0060.00320.24
8.3.10.0040.00423.53
8.3.00.0080.00019.26
8.2.170.0060.00922.96
8.2.160.0070.01020.35
8.2.150.0050.00324.18
8.2.140.0060.00324.66
8.2.130.0140.00326.16
8.2.120.0040.00422.25
8.2.110.0040.00721.11
8.2.100.0090.00317.72
8.2.90.0080.00018.22
8.2.80.0080.00017.97
8.2.70.0040.00418.04
8.2.60.0060.00318.03
8.2.50.0050.00318.10
8.2.40.0000.01120.59
8.2.30.0050.00318.09
8.2.20.0000.00817.73
8.2.10.0000.00818.13
8.2.00.0090.00017.68
8.1.270.0040.00422.14
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0090.00623.96
8.1.230.0090.00320.85
8.1.220.0000.00817.79
8.1.210.0000.00818.85
8.1.200.0050.00317.35
8.1.190.0000.00917.25
8.1.180.0030.00518.10
8.1.170.0030.00618.64
8.1.160.0040.00422.10
8.1.150.0000.00818.67
8.1.140.0000.00717.48
8.1.130.0070.00017.76
8.1.120.0000.00717.49
8.1.110.0080.00017.46
8.1.100.0000.00717.38
8.1.90.0070.00017.53
8.1.80.0040.00417.48
8.1.70.0040.00417.44
8.1.60.0000.00817.60
8.1.50.0060.00317.49
8.1.40.0040.00417.40
8.1.30.0030.00517.64
8.1.20.0040.00417.71
8.1.10.0020.00517.58
8.1.00.0000.00817.46
8.0.300.0030.00619.90
8.0.290.0080.00016.75
8.0.280.0000.00718.41
8.0.270.0000.00717.20
8.0.260.0030.00316.86
8.0.250.0030.00317.01
8.0.240.0000.01016.97
8.0.230.0070.00016.96
8.0.220.0040.00316.82
8.0.210.0040.00416.86
8.0.200.0030.00316.92
8.0.190.0070.00016.95
8.0.180.0000.00717.00
8.0.170.0030.00616.96
8.0.160.0000.00716.95
8.0.150.0070.00016.93
8.0.140.0050.00216.91
8.0.130.0040.00413.22
8.0.120.0060.00316.89
8.0.110.0000.00816.92
8.0.100.0040.00416.99
8.0.90.0000.00816.80
8.0.80.0100.01016.87
8.0.70.0050.00316.82
8.0.60.0000.00816.85
8.0.50.0050.00316.88
8.0.30.0180.00117.28
8.0.20.0120.00717.40
8.0.10.0030.00616.86
8.0.00.0140.00316.84
7.4.330.0050.00015.07
7.4.320.0000.00616.53
7.4.300.0040.00416.65
7.4.290.0040.00416.56
7.4.280.0070.00016.54
7.4.270.0000.00816.39
7.4.260.0000.00716.57
7.4.250.0050.00316.51
7.4.240.0020.00616.50
7.4.230.0000.00716.71
7.4.220.0170.00016.57
7.4.210.0090.00816.57
7.4.200.0000.00716.52
7.4.190.0050.00316.55
7.4.160.0050.01616.75
7.4.150.0140.01117.40
7.4.140.0080.01417.86
7.4.130.0100.01016.44
7.4.120.0120.00916.47
7.4.110.0120.00416.41
7.4.100.0050.01416.54
7.4.90.0090.01016.38
7.4.80.0160.00619.39
7.4.70.0100.00716.49
7.4.60.0040.01216.64
7.4.50.0030.00616.51
7.4.40.0050.00922.77
7.4.30.0000.01616.65
7.4.00.0030.01215.03
7.3.330.0050.00013.21
7.3.320.0000.00613.26
7.3.310.0030.00316.42
7.3.300.0000.00716.23
7.3.290.0140.00416.44
7.3.280.0060.01316.40
7.3.270.0070.01017.40
7.3.260.0190.01116.72
7.3.250.0080.01216.55
7.3.240.0130.00316.59
7.3.230.0030.01316.59
7.3.210.0090.00916.76
7.3.200.0130.00919.39
7.3.190.0120.00916.42
7.3.180.0060.00916.32
7.3.170.0120.00416.59
7.3.160.0060.00916.45
7.3.120.0060.00614.85
7.2.330.0120.00616.52
7.2.320.0100.01416.55
7.2.310.0100.00716.78
7.2.300.0100.01416.81
7.2.290.0090.00916.55
7.2.60.0000.01316.67
7.2.00.0070.00719.36
7.1.200.0000.01215.74
7.1.100.0000.01218.26
7.1.70.0090.00917.19
7.1.60.0190.00619.33
7.1.50.0040.01917.01
7.1.00.0070.07322.57
7.0.200.0060.00316.94
7.0.140.0100.07021.95
7.0.100.0000.05019.93
7.0.90.0100.07719.96
7.0.80.0200.04020.04
7.0.70.0030.08719.92
7.0.60.0100.07719.97
7.0.50.0100.07720.31
7.0.40.0070.05320.07
7.0.30.0000.07320.14
7.0.20.0070.06320.04
7.0.10.0070.07720.13
7.0.00.0030.06320.13
5.6.280.0070.06721.13
5.6.250.0070.04720.79
5.6.240.0000.04720.69
5.6.230.0030.08720.68
5.6.220.0070.08020.60
5.6.210.0170.07020.69
5.6.200.0130.04720.99
5.6.190.0100.07321.05
5.6.180.0100.05321.02
5.6.170.0070.04020.93
5.6.160.0070.07721.04
5.6.150.0100.07021.03
5.6.140.0070.06721.07
5.6.130.0030.09020.96
5.6.120.0030.08721.09
5.6.110.0030.08021.13
5.6.100.0100.07021.05
5.6.90.0030.07721.05
5.6.80.0070.07020.38
5.6.70.0070.04720.36
5.6.60.0070.05020.51
5.6.50.0070.03720.36
5.6.40.0100.06320.48
5.6.30.0100.06720.43
5.6.20.0100.07020.34
5.6.10.0100.08020.31
5.6.00.0000.06020.53
5.5.380.0100.07020.35
5.5.370.0170.07020.34
5.5.360.0070.08320.38
5.5.350.0070.06020.38
5.5.340.0100.08020.91
5.5.330.0100.06320.95
5.5.320.0000.06720.95
5.5.310.0070.08320.91
5.5.300.0030.08320.83
5.5.290.0030.07720.95
5.5.280.0070.06020.89
5.5.270.0130.08020.92
5.5.260.0070.04020.85
5.5.250.0000.05720.61
5.5.240.0070.05720.13
5.5.230.0100.03320.21
5.5.220.0170.07020.28
5.5.210.0000.07320.16
5.5.200.0030.04020.18
5.5.190.0070.07020.29
5.5.180.0070.07320.24
5.5.160.0000.08320.26
5.5.150.0070.08320.30
5.5.140.0100.07320.10
5.5.130.0030.07720.25
5.5.120.0000.08320.28
5.5.110.0000.04720.26
5.5.100.0170.04720.18
5.5.90.0000.06720.14
5.5.80.0000.06720.20
5.5.70.0170.07020.18
5.5.60.0030.06720.16
5.5.50.0070.07720.18
5.5.40.0100.07319.95
5.5.30.0030.07320.05
5.5.20.0030.08020.16
5.5.10.0000.08720.00
5.5.00.0100.06020.13
5.4.450.0030.06019.46
5.4.440.0030.08319.56
5.4.430.0130.07319.20
5.4.420.0030.04319.45
5.4.410.0030.05319.09
5.4.400.0000.08019.05
5.4.390.0100.07319.03
5.4.380.0030.04318.91
5.4.370.0070.07318.86
5.4.360.0000.04319.25
5.4.350.0030.07319.09
5.4.340.0000.06018.95
5.4.320.0070.08019.04
5.4.310.0000.06318.90
5.4.300.0070.07719.12
5.4.290.0100.07019.03
5.4.280.0000.05019.12
5.4.270.0130.05719.04
5.4.260.0030.03718.85
5.4.250.0100.03718.89
5.4.240.0000.05319.04
5.4.230.0070.06719.09
5.4.220.0030.04019.04
5.4.210.0000.07719.13
5.4.200.0170.06319.02
5.4.190.0070.06319.11
5.4.180.0130.04319.13
5.4.170.0070.08018.94
5.4.160.0070.06319.16
5.4.150.0030.04019.22
5.4.140.0030.06316.46
5.4.130.0070.06716.34
5.4.120.0100.07016.18
5.4.110.0030.04716.55
5.4.100.0070.03316.45
5.4.90.0030.06716.41
5.4.80.0100.05716.55
5.4.70.0070.04316.39
5.4.60.0030.07316.37
5.4.50.0130.05316.49
5.4.40.0100.06716.36
5.4.30.0000.07716.31
5.4.20.0170.05716.48
5.4.10.0030.07016.49
5.4.00.0100.07015.86
5.3.290.0100.07014.64
5.3.280.0100.06714.76
5.3.270.0070.06014.62
5.3.260.0000.05014.57
5.3.250.0030.04014.69
5.3.240.0100.07714.65
5.3.230.0070.06714.67
5.3.220.0030.07714.55
5.3.210.0100.07314.64
5.3.200.0070.03314.57
5.3.190.0100.06714.58
5.3.180.0030.05014.62
5.3.170.0100.07014.63
5.3.160.0100.07014.65
5.3.150.0030.07014.57
5.3.140.0030.07714.57
5.3.130.0200.06014.66
5.3.120.0000.04314.70
5.3.110.0030.03714.50
5.3.100.0070.03714.08
5.3.90.0030.07013.98
5.3.80.0030.07314.11
5.3.70.0130.06314.02
5.3.60.0070.07013.92
5.3.50.0030.07013.95
5.3.40.0030.05314.11
5.3.30.0070.07313.94
5.3.20.0070.07313.62
5.3.10.0070.07013.67
5.3.00.0000.05313.69
5.2.170.0130.04311.26
5.2.160.0070.02311.03
5.2.150.0000.06011.16
5.2.140.0000.04311.25
5.2.130.0030.06711.26
5.2.120.0000.06011.14
5.2.110.0000.06311.11
5.2.100.0000.03011.23
5.2.90.0100.05311.18
5.2.80.0130.02311.24
5.2.70.0070.05311.02
5.2.60.0000.05011.04
5.2.50.0030.05010.96
5.2.40.0070.05711.06
5.2.30.0030.06311.13
5.2.20.0030.04710.92
5.2.10.0100.05310.82
5.2.00.0030.06010.84
5.1.60.0130.04310.28
5.1.50.0030.05310.28
5.1.40.0070.04710.28
5.1.30.0070.05310.48
5.1.20.0030.05310.37
5.1.10.0070.04710.28
5.1.00.0030.05710.28
5.0.50.0000.04710.28
5.0.40.0070.04010.28
5.0.30.0000.05310.28
5.0.20.0000.04310.28
5.0.10.0000.04310.28
5.0.00.0000.03010.28
4.4.90.0000.03710.28
4.4.80.0030.03310.28
4.4.70.0030.03710.28
4.4.60.0030.03010.28
4.4.50.0000.03310.28
4.4.40.0000.05710.28
4.4.30.0030.01310.28
4.4.20.0000.01710.28
4.4.10.0030.03710.28
4.4.00.0030.05010.28
4.3.110.0000.03010.28
4.3.100.0000.01710.28
4.3.90.0000.03310.28
4.3.80.0000.05310.28
4.3.70.0030.03010.28
4.3.60.0030.01310.28
4.3.50.0000.03710.28
4.3.40.0000.02310.28
4.3.30.0000.02710.28
4.3.20.0000.03710.28
4.3.10.0000.03010.28
4.3.00.0000.01710.28

preferences:
48.47 ms | 400 KiB | 5 Q