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()) { $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 & 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.70.0040.01816.50
8.3.60.0140.00716.38
8.3.50.0100.00718.18
8.3.40.0070.01118.65
8.3.30.0150.00018.78
8.3.20.0040.00418.73
8.3.10.0030.00620.59
8.3.00.0140.00519.26
8.2.180.0110.00716.88
8.2.170.0100.01022.96
8.2.160.0100.00618.82
8.2.150.0040.00424.18
8.2.140.0090.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00418.90
8.2.110.0040.00721.12
8.2.100.0090.00317.84
8.2.90.0090.00019.27
8.2.80.0000.00719.25
8.2.70.0090.00017.38
8.2.60.0040.00417.93
8.2.50.0030.00518.07
8.2.40.0030.00620.01
8.2.30.0000.00818.18
8.2.20.0000.00817.63
8.2.10.0000.00717.72
8.2.00.0070.00017.66
8.1.280.0150.00425.92
8.1.270.0030.00623.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00322.50
8.1.230.0090.00320.97
8.1.220.0060.00317.77
8.1.210.0070.00318.85
8.1.200.0090.00017.23
8.1.190.0000.00817.27
8.1.180.0000.00818.10
8.1.170.0040.00420.50
8.1.160.0090.00018.78
8.1.150.0050.00318.76
8.1.140.0040.00417.51
8.1.130.0030.00317.89
8.1.120.0050.00317.47
8.1.110.0030.00517.47
8.1.100.0030.00617.36
8.1.90.0000.00717.37
8.1.80.0040.00417.36
8.1.70.0030.00517.41
8.1.60.0000.00817.63
8.1.50.0030.00617.45
8.1.40.0000.00817.55
8.1.30.0000.00817.64
8.1.20.0040.00417.63
8.1.10.0040.00417.50
8.1.00.0030.00617.52
8.0.300.0070.00020.03
8.0.290.0030.00516.63
8.0.280.0030.00318.41
8.0.270.0030.00317.30
8.0.260.0030.00316.75
8.0.250.0030.00516.96
8.0.240.0040.00417.00
8.0.230.0030.00316.86
8.0.220.0030.00316.80
8.0.210.0000.00716.80
8.0.200.0030.00317.00
8.0.190.0040.00316.96
8.0.180.0020.00516.97
8.0.170.0030.00616.83
8.0.160.0040.00417.02
8.0.150.0030.00516.91
8.0.140.0000.00816.88
8.0.130.0000.00513.26
8.0.120.0000.00716.75
8.0.110.0040.00416.81
8.0.100.0000.00716.95
8.0.90.0040.00416.79
8.0.80.0070.01116.95
8.0.70.0000.00716.89
8.0.60.0070.00016.88
8.0.50.0070.00016.93
8.0.30.0100.01017.19
8.0.20.0120.00617.25
8.0.10.0070.00017.05
8.0.00.0140.00416.77
7.4.330.0000.00513.02
7.4.320.0030.00316.58
7.4.300.0030.00516.52
7.4.290.0000.00816.44
7.4.280.0040.00416.51
7.4.270.0000.00816.63
7.4.260.0000.00513.32
7.4.250.0080.00016.51
7.4.240.0080.00016.66
7.4.230.0030.00316.60
7.4.220.0130.01016.48
7.4.210.0040.01116.64
7.4.200.0000.00716.71
7.4.190.0020.00516.38
7.4.160.0130.00316.51
7.4.150.0070.01216.47
7.4.140.0100.00716.27
7.4.130.0170.00016.64
7.4.120.0070.01016.42
7.4.110.0120.00616.55
7.4.100.0110.00616.48
7.4.90.0200.00016.57
7.4.80.0140.00419.39
7.4.70.0050.01316.35
7.4.60.0070.01016.52
7.4.50.0040.00416.52
7.4.40.0030.01316.60
7.4.30.0130.00716.42
7.4.00.0070.01014.75
7.3.330.0030.00313.37
7.3.320.0030.00313.32
7.3.310.0040.00416.35
7.3.300.0000.00716.35
7.3.290.0050.00916.40
7.3.280.0110.00616.38
7.3.270.0110.00616.71
7.3.260.0070.01016.41
7.3.250.0100.01116.65
7.3.240.0100.01316.63
7.3.230.0130.00316.59
7.3.210.0120.00616.67
7.3.200.0130.00416.39
7.3.190.0150.00616.44
7.3.180.0090.00616.56
7.3.170.0070.01016.53
7.3.160.0090.00616.63
7.3.120.0080.00515.09
7.2.330.0040.01416.51
7.2.320.0070.01516.48
7.2.310.0160.00616.50
7.2.300.0110.00716.80
7.2.290.0070.01016.56
7.2.60.0030.01016.64
7.2.00.0000.01419.52
7.1.200.0150.00015.90
7.1.100.0040.00718.16
7.1.70.0030.00717.06
7.1.60.0100.01319.31
7.1.50.0130.01016.88
7.1.00.0030.07722.29
7.0.200.0060.00316.78
7.0.140.0070.07022.07
7.0.120.0100.06022.16
7.0.60.0130.06020.02
7.0.50.0070.05717.88
7.0.40.0070.09020.22
7.0.30.0370.06020.15
7.0.20.0270.08020.19
7.0.10.0000.04720.15
7.0.00.0030.06720.20
5.6.280.0100.06320.79
5.6.210.0070.08020.71
5.6.200.0070.08018.13
5.6.190.0070.04320.69
5.6.180.0200.08020.67
5.6.170.0570.06720.72
5.6.160.0100.03720.57
5.6.150.0000.05018.15
5.6.140.0100.07718.17
5.6.130.0030.07718.19
5.6.120.0170.04321.03
5.6.110.0100.08320.91
5.6.100.0070.09021.00
5.6.90.0070.09020.97
5.6.80.0030.06320.49
5.6.70.4400.04020.55
5.5.350.0070.07020.39
5.5.340.0070.05317.99
5.5.330.0170.07320.41
5.5.320.0130.07320.25
5.5.310.0170.04020.27
5.5.300.0030.08017.98
5.5.290.0070.07018.01
5.5.280.0030.05020.76
5.5.270.0070.03720.74
5.5.260.0070.08320.98
5.5.250.0070.08020.61
5.5.240.0330.05320.37
5.4.450.0170.07019.47
5.4.440.0100.08019.48
5.4.430.0130.07719.32
5.4.420.0200.06319.56
5.4.410.0100.03719.06
5.4.400.0070.06018.93
5.4.390.0070.05719.14
5.4.380.0100.07018.85
5.4.370.0100.04019.00
5.4.360.0070.06319.22
5.4.350.0070.04719.15
5.4.340.0070.07719.12
5.4.320.0070.08019.14
5.4.310.0100.05319.00
5.4.300.0070.06318.98
5.4.290.0100.06718.85
5.4.280.0000.05319.00
5.4.270.0100.05319.15
5.4.260.0070.07719.20
5.4.250.0000.08718.85
5.4.240.0030.07719.14
5.4.230.0070.08018.99
5.4.220.0100.07318.97
5.4.210.0130.04319.15
5.4.200.0030.04019.26
5.4.190.0130.03018.99
5.4.180.0100.07019.23
5.4.170.0130.05019.14
5.4.160.0100.07318.83
5.4.150.0100.04319.19
5.4.140.0100.06716.36
5.4.130.0030.07716.43
5.4.120.0100.06016.41
5.4.110.0100.04016.45
5.4.100.0100.05016.47
5.4.90.0070.03316.46
5.4.80.0130.07016.57
5.4.70.0100.07316.31
5.4.60.0000.07716.36
5.4.50.0100.03316.37
5.4.40.0030.04016.40
5.4.30.0000.07316.36
5.4.20.0100.06716.46
5.4.10.0030.04716.30
5.4.00.0070.06715.80
5.3.290.0030.08714.58
5.3.280.0070.07314.68
5.3.270.0030.05314.62
5.3.260.0100.06714.51
5.3.250.0030.07714.62
5.3.240.0030.06714.77
5.3.230.0030.04314.62
5.3.220.0100.07014.66
5.3.210.0100.07314.62
5.3.200.0070.07314.61
5.3.190.0030.07714.62
5.3.180.0100.07714.56
5.3.170.0030.06714.59
5.3.160.0070.07314.59
5.3.150.0030.05014.65
5.3.140.0100.07314.63
5.3.130.0070.05714.46
5.3.120.0100.05314.64
5.3.110.0030.08014.58
5.3.100.0030.06014.23
5.3.90.0130.03714.19
5.3.80.0030.07313.96
5.3.70.0130.04714.04
5.3.60.0070.07714.18
5.3.50.0070.04314.13
5.3.40.0100.04313.98
5.3.30.0130.06013.82
5.3.20.0030.07713.75
5.3.10.0130.05713.83
5.3.00.0130.05713.70
5.2.170.0030.03011.10
5.2.160.0000.06311.23
5.2.150.0000.04311.21
5.2.140.0030.06311.22
5.2.130.0070.06011.28
5.2.120.0070.06311.21
5.2.110.0030.05311.05
5.2.100.0070.05711.04
5.2.90.0070.05711.18
5.2.80.0130.05311.12
5.2.70.0030.04711.00
5.2.60.0070.06011.15
5.2.50.0100.03310.94
5.2.40.0000.07011.02
5.2.30.0070.05310.99
5.2.20.0070.06010.99
5.2.10.0000.05710.94
5.2.00.0100.03310.86
5.1.60.0000.0339.99
5.1.50.0030.04310.18
5.1.40.0070.03010.01
5.1.30.0030.02710.41
5.1.20.0030.02710.37
5.1.10.0030.05710.18
5.1.00.0030.03710.24
5.0.50.0000.0439.43
5.0.40.0030.0409.43
5.0.30.0000.0409.43
5.0.20.0000.0239.43
5.0.10.0030.0379.43
5.0.00.0070.0579.43
4.4.90.0030.0209.43
4.4.80.0000.0309.43
4.4.70.0070.0339.43
4.4.60.0070.0309.43
4.4.50.0030.0209.43
4.4.40.0000.0439.43
4.4.30.0000.0279.43
4.4.20.0070.0139.43
4.4.10.0000.0239.43
4.4.00.0070.0379.43
4.3.110.0030.0239.43
4.3.100.0030.0179.43
4.3.90.0030.0179.43
4.3.80.0000.0509.43
4.3.70.0000.0379.43
4.3.60.0030.0339.43
4.3.50.0070.0309.43
4.3.40.0030.0339.43
4.3.30.0030.0279.43
4.3.20.0000.0239.43
4.3.10.0030.0139.43
4.3.00.0030.0309.43

preferences:
49.59 ms | 401 KiB | 5 Q