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()) { 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("\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.60.0060.01216.50
8.3.50.0140.00617.45
8.3.40.0120.00318.58
8.3.30.0090.00618.75
8.3.20.0080.00018.67
8.3.10.0080.00020.65
8.3.00.0030.00519.25
8.2.180.0090.00916.63
8.2.170.0060.00922.96
8.2.160.0100.00721.20
8.2.150.0050.00324.18
8.2.140.0060.00324.66
8.2.130.0030.00526.16
8.2.120.0030.00619.21
8.2.110.0110.00318.76
8.2.100.0080.00417.98
8.2.90.0060.00319.36
8.2.80.0030.00617.97
8.2.70.0060.00317.63
8.2.60.0040.00417.92
8.2.50.0060.00318.07
8.2.40.0040.00418.16
8.2.30.0030.00718.15
8.2.20.0070.00017.61
8.2.10.0060.00317.75
8.2.00.0000.00817.70
8.1.280.0040.01125.92
8.1.270.0070.00724.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00621.30
8.1.230.0050.00517.57
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0030.00617.22
8.1.190.0050.00317.35
8.1.180.0000.00818.10
8.1.170.0040.00418.93
8.1.160.0040.00418.83
8.1.150.0000.00718.68
8.1.140.0000.00717.42
8.1.130.0030.00317.94
8.1.120.0000.00717.38
8.1.110.0040.00417.38
8.1.100.0000.00717.48
8.1.90.0040.00417.51
8.1.80.0070.00017.50
8.1.70.0030.00317.46
8.1.60.0040.00417.51
8.1.50.0060.00317.52
8.1.40.0000.00817.45
8.1.30.0040.00417.66
8.1.20.0000.00817.67
8.1.10.0040.00417.59
8.1.00.0090.00017.54
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0040.00418.57
8.0.270.0030.00317.28
8.0.260.0000.00616.80
8.0.250.0030.00716.92
8.0.240.0000.00816.85
8.0.230.0070.00017.02
8.0.220.0000.00716.92
8.0.210.0030.00316.95
8.0.200.0040.00416.99
8.0.190.0040.00416.98
8.0.180.0040.00416.95
8.0.170.0000.00916.89
8.0.160.0030.00316.91
8.0.150.0000.00816.75
8.0.140.0040.00416.77
8.0.130.0060.00013.29
8.0.120.0000.00716.81
8.0.110.0000.00816.82
8.0.100.0000.00816.98
8.0.90.0020.00516.98
8.0.80.0030.01216.97
8.0.70.0040.00416.93
8.0.60.0070.00016.97
8.0.50.0030.00516.88
8.0.30.0140.00817.25
8.0.20.0090.00917.08
8.0.10.0030.00616.91
8.0.00.0130.00916.80
7.4.330.0030.00313.07
7.4.320.0000.00616.46
7.4.300.0030.00316.61
7.4.290.0000.00716.51
7.4.280.0040.00416.39
7.4.270.0000.00716.45
7.4.260.0060.00013.29
7.4.250.0040.00416.57
7.4.240.0000.00716.50
7.4.230.0030.00316.61
7.4.220.0000.01716.58
7.4.210.0100.00716.56
7.4.200.0000.00716.36
7.4.190.0040.00416.54
7.4.160.0120.01216.41
7.4.150.0160.01016.55
7.4.140.0140.00916.55
7.4.130.0080.01016.50
7.4.120.0120.00616.47
7.4.110.0090.00916.64
7.4.100.0160.00616.60
7.4.90.0130.01016.64
7.4.80.0180.00319.39
7.4.70.0170.00316.44
7.4.60.0130.00416.54
7.4.50.0090.00416.64
7.4.40.0070.01116.41
7.4.30.0160.00716.74
7.4.00.0020.01414.95
7.3.330.0030.00313.41
7.3.320.0030.00313.22
7.3.310.0040.00416.45
7.3.300.0030.00316.42
7.3.290.0050.00916.41
7.3.280.0110.00716.38
7.3.270.0060.01216.66
7.3.260.0070.01016.47
7.3.250.0110.01316.66
7.3.240.0120.00616.40
7.3.230.0060.01216.76
7.3.210.0110.00716.61
7.3.200.0110.01116.47
7.3.190.0080.01116.47
7.3.180.0100.00616.31
7.3.170.0040.01216.50
7.3.160.0090.00916.59
7.3.120.0100.00615.00
7.3.110.0040.01114.99
7.3.100.0090.00314.73
7.3.90.0110.00314.67
7.3.80.0040.01214.84
7.3.70.0030.01014.88
7.3.60.0110.00314.76
7.3.50.0100.01014.90
7.3.40.0040.00814.76
7.3.30.0030.01014.61
7.3.20.0030.01016.74
7.3.10.0140.00616.42
7.3.00.0080.01216.37
7.2.330.0110.00916.49
7.2.320.0170.00816.84
7.2.310.0080.01116.69
7.2.300.0060.00916.82
7.2.290.0100.00716.84
7.2.250.0130.00614.79
7.2.240.0000.02115.16
7.2.230.0040.00714.88
7.2.220.0080.00414.85
7.2.210.0060.00915.12
7.2.200.0070.01015.15
7.2.190.0080.00615.09
7.2.180.0040.00815.00
7.2.170.0030.01014.88
7.2.130.0100.00516.60
7.2.120.0080.01216.45
7.2.110.0050.00816.81
7.2.100.0070.00916.56
7.2.90.0130.00316.67
7.2.80.0100.00716.68
7.2.70.0060.01216.71
7.2.60.0050.00616.42
7.2.50.0090.00616.64
7.2.40.0090.01016.73
7.2.30.0090.00716.94
7.2.20.0090.00816.35
7.2.10.0110.00816.86
7.2.00.0090.00716.80
7.1.330.0030.01215.43
7.1.320.0030.00915.95
7.1.310.0040.01215.88
7.1.300.0120.00815.77
7.1.290.0030.01015.82
7.1.280.0070.00315.55
7.1.270.0040.01115.75
7.1.260.0100.00715.54
7.1.250.0110.00515.70
7.1.240.0030.00615.87
7.1.230.0070.00315.61
7.1.220.0030.01015.65
7.1.210.0030.00715.58
7.1.200.0090.00615.61
7.1.190.0110.00015.60
7.1.180.0110.00415.44
7.1.170.0060.00615.70
7.1.160.0050.00315.81
7.1.150.0060.01215.46
7.1.140.0110.00315.86
7.1.130.0030.00915.73
7.1.120.0090.00315.68
7.1.110.0070.00315.70
7.1.100.0030.00917.09
7.1.90.0030.00615.90
7.1.80.0040.01115.55
7.1.70.0060.00516.57
7.1.60.0050.01317.56
7.1.50.0050.01016.49
7.1.40.0030.00915.47
7.1.30.0040.00415.74
7.1.20.0060.00615.52
7.1.10.0050.00515.73
7.1.00.0020.02819.09
7.0.330.0040.00815.06
7.0.320.0060.00615.23
7.0.310.0030.01015.35
7.0.300.0000.00815.08
7.0.290.0040.00815.27
7.0.280.0070.01015.15
7.0.270.0060.00615.30
7.0.260.0120.00615.26
7.0.250.0030.00815.43
7.0.240.0110.00015.43
7.0.230.0070.00315.50
7.0.220.0070.00415.21
7.0.210.0000.01315.54
7.0.200.0060.00616.19
7.0.190.0030.00615.50
7.0.180.0030.00315.29
7.0.170.0030.00915.52
7.0.160.0090.00315.03
7.0.150.0100.00015.35
7.0.140.0050.03818.68
7.0.130.0040.00815.65
7.0.120.0040.03818.72
7.0.110.0030.00715.51
7.0.100.0090.00315.07
7.0.90.0000.01015.50
7.0.80.0000.01415.12
7.0.70.0080.00415.50
7.0.60.0050.03317.68
7.0.50.0090.04116.63
7.0.40.0020.02916.88
7.0.30.0180.04116.82
7.0.20.0200.02616.73
7.0.10.0070.04516.73
7.0.00.0050.04016.92
5.6.380.0040.00414.13
5.6.370.0000.01414.37
5.6.360.0000.01414.20
5.6.350.0100.00014.71
5.6.340.0070.01014.49
5.6.330.0080.00614.69
5.6.320.0030.01214.19
5.6.310.0000.01214.52
5.6.300.0060.00314.27
5.6.290.0030.00614.52
5.6.280.0020.04017.73
5.6.270.0110.00014.28
5.6.260.0060.00614.45
5.6.250.0040.00714.24
5.6.240.0000.01214.53
5.6.230.0080.00414.16
5.6.220.0030.00714.19
5.6.210.0050.02517.29
5.6.200.0050.02316.14
5.6.190.0100.04217.42
5.6.180.0120.02817.61
5.6.170.0150.04417.35
5.6.160.0090.04017.49
5.6.150.0070.04416.42
5.6.140.0070.04216.17
5.6.130.0050.03916.42
5.6.120.0070.04917.61
5.6.110.0030.03717.71
5.6.100.0040.03917.66
5.6.90.0030.03317.66
5.6.80.0050.02517.54
5.6.70.0100.00014.25
5.6.60.0090.00614.30
5.6.50.0080.00814.49
5.6.40.0030.00914.51
5.6.30.0030.01014.20
5.6.20.0060.00914.69
5.6.10.0130.00014.44
5.6.00.0030.00914.60
5.5.380.0000.00711.18
5.5.370.0050.00011.50
5.5.360.0060.00311.18
5.5.350.0040.04115.85
5.5.340.0070.04014.73
5.5.330.0040.04015.81
5.5.320.0200.02715.77
5.5.310.0170.03915.72
5.5.300.0050.04114.63
5.5.290.0070.04614.56
5.5.280.0030.02316.12
5.5.270.0140.04016.16
5.5.260.0050.04316.03
5.5.250.0160.03115.93
5.5.240.0140.03715.75
5.5.230.0030.00311.18
5.5.220.0060.00311.18
5.5.210.0030.00711.21
5.5.200.0040.00411.18
5.5.190.0030.00611.30
5.5.180.0000.01011.18
5.5.170.0030.00311.18
5.5.160.0040.00911.22
5.5.150.0040.00411.26
5.5.140.0000.01111.18
5.5.130.0070.00311.24
5.5.120.0040.00411.18
5.5.110.0040.00411.18
5.5.100.0070.00011.18
5.5.90.0090.00011.29
5.5.80.0060.00311.18
5.5.70.0000.00711.18
5.5.60.0060.00611.18
5.5.50.0040.00411.18
5.5.40.0030.00511.18
5.5.30.0050.00511.18
5.5.20.0000.00711.18
5.5.10.0030.00611.27
5.5.00.0030.00611.18
5.4.450.0070.02715.37
5.4.440.0020.04415.33
5.4.430.0040.04215.32
5.4.420.0050.02615.33
5.4.410.0050.03015.39
5.4.400.0060.02515.19
5.4.390.0000.03115.17
5.4.380.0030.02615.14
5.4.370.0070.03615.16
5.4.360.0050.04115.08
5.4.350.0070.02315.13
5.4.340.0070.01815.16
5.4.330.0130.00011.18
5.4.320.0130.03515.21
5.4.310.0080.03815.02
5.4.300.0080.03715.05
5.4.290.0030.03215.19
5.4.280.0070.03815.16
5.4.270.0060.03515.16
5.4.260.0050.03615.09
5.4.250.0100.03315.02
5.4.240.0090.03715.16
5.4.230.0040.04515.19
5.4.220.0000.04515.08
5.4.210.0050.02415.04
5.4.200.0030.04415.21
5.4.190.0030.04015.07
5.4.180.0060.02515.18
5.4.170.0080.03715.16
5.4.160.0030.04315.09
5.4.150.0080.03415.20
5.4.140.0070.03813.85
5.4.130.0020.04013.82
5.4.120.0050.02213.82
5.4.110.0050.03913.81
5.4.100.0080.01813.83
5.4.90.0070.03713.84
5.4.80.0060.02113.93
5.4.70.0030.02013.79
5.4.60.0080.03313.77
5.4.50.0000.04513.78
5.4.40.0070.02513.81
5.4.30.0070.03513.79
5.4.20.0090.03513.76
5.4.10.0060.03113.91
5.4.00.0050.04213.54
5.3.290.0090.02212.90
5.3.280.0020.04112.90
5.3.270.0020.03012.93
5.3.260.0050.04012.85
5.3.250.0020.03912.94
5.3.240.0060.04012.91
5.3.230.0050.04012.97
5.3.220.0030.02012.90
5.3.210.0030.04012.85
5.3.200.0000.02612.88
5.3.190.0030.02912.96
5.3.180.0060.02812.89
5.3.170.0020.02212.88
5.3.160.0070.03712.84
5.3.150.0050.02812.91
5.3.140.0040.03912.90
5.3.130.0050.03612.91
5.3.120.0080.03512.89
5.3.110.0030.03812.87
5.3.100.0070.03012.64
5.3.90.0060.03412.70
5.3.80.0030.02512.57
5.3.70.0060.03212.61
5.3.60.0050.04212.68
5.3.50.0030.03712.65
5.3.40.0050.04012.59
5.3.30.0030.02312.58
5.3.20.0030.02512.45
5.3.10.0050.02212.51
5.3.00.0040.02612.42
5.2.170.0050.03311.18
5.2.160.0050.03311.25
5.2.150.0110.02211.14
5.2.140.0000.03611.21
5.2.130.0020.01811.18
5.2.120.0080.01311.23
5.2.110.0030.02811.14
5.2.100.0070.01911.15
5.2.90.0030.01811.10
5.2.80.0060.02611.22
5.2.70.0040.02911.19
5.2.60.0020.02211.20
5.2.50.0030.03311.14
5.2.40.0030.02711.10
5.2.30.0060.02611.17
5.2.20.0000.03211.10
5.2.10.0000.03511.01
5.2.00.0030.02610.98
5.1.60.0030.01610.62
5.1.50.0020.01910.63
5.1.40.0040.02910.54
5.1.30.0020.03410.79
5.1.20.0030.03210.77
5.1.10.0030.02510.65
5.1.00.0020.02210.63
5.0.50.0060.0239.94
5.0.40.0010.0209.79
5.0.30.0030.0289.78
5.0.20.0020.0199.76
5.0.10.0030.0129.69
5.0.00.0030.0359.70
4.4.90.0040.0149.56
4.4.80.0010.0109.56
4.4.70.0080.0119.56
4.4.60.0060.0109.56
4.4.50.0040.0179.56
4.4.40.0020.0229.56
4.4.30.0020.0229.56
4.4.20.0030.0129.56
4.4.10.0020.0129.56
4.4.00.0050.0239.56
4.3.110.0060.0139.56
4.3.100.0030.0209.56
4.3.90.0010.0109.56
4.3.80.0020.0159.56
4.3.70.0030.0189.56
4.3.60.0000.0179.56
4.3.50.0020.0189.56
4.3.40.0020.0189.56
4.3.30.0020.0139.56
4.3.20.0020.0129.56
4.3.10.0040.0169.56
4.3.00.0030.0109.56

preferences:
49.59 ms | 401 KiB | 5 Q