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] << 32) | $longs[1]; if ($signBit && !$isSigned) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } else { $result = 0; } return $result; } var_dump(unpack_int64("\x00\x00\x00\x00\x00\x00\x00\x01", 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.0100.00716.50
8.3.50.0040.01517.54
8.3.40.0110.00418.53
8.3.30.0040.01218.84
8.3.20.0050.00318.83
8.3.10.0040.00420.27
8.3.00.0030.00619.51
8.2.180.0160.00316.63
8.2.170.0090.00922.96
8.2.160.0090.00621.14
8.2.150.0000.00724.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0030.00519.48
8.2.110.0070.00421.05
8.2.100.0060.00617.91
8.2.90.0000.00921.03
8.2.80.0030.00617.93
8.2.70.0060.00317.50
8.2.60.0050.00317.80
8.2.50.0000.00818.07
8.2.40.0040.00418.22
8.2.30.0000.00718.20
8.2.20.0050.00217.64
8.2.10.0000.00717.77
8.2.00.0000.00817.79
8.1.280.0080.00825.92
8.1.270.0070.00024.66
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0030.00620.83
8.1.230.0030.00720.96
8.1.220.0080.00017.79
8.1.210.0080.00018.77
8.1.200.0030.00617.35
8.1.190.0000.00817.52
8.1.180.0050.00318.10
8.1.170.0000.00818.96
8.1.160.0000.00718.91
8.1.150.0070.00018.69
8.1.140.0060.00317.42
8.1.130.0030.00317.80
8.1.120.0030.00517.41
8.1.110.0000.00717.48
8.1.100.0000.00717.44
8.1.90.0000.00717.35
8.1.80.0000.00717.49
8.1.70.0030.00317.36
8.1.60.0000.00717.55
8.1.50.0040.00417.52
8.1.40.0040.00417.56
8.1.30.0040.00417.53
8.1.20.0000.00817.66
8.1.10.0040.00417.57
8.1.00.0000.00717.41
8.0.300.0040.00420.09
8.0.290.0040.00416.75
8.0.280.0000.00718.38
8.0.270.0000.00717.29
8.0.260.0030.00516.74
8.0.250.0050.00316.85
8.0.240.0000.00917.00
8.0.230.0000.00717.01
8.0.220.0000.00716.92
8.0.210.0040.00416.73
8.0.200.0000.00616.86
8.0.190.0040.00416.95
8.0.180.0040.00416.82
8.0.170.0030.00616.95
8.0.160.0070.00016.93
8.0.150.0060.00316.83
8.0.140.0040.00416.83
8.0.130.0030.00313.30
8.0.120.0050.00316.76
8.0.110.0000.00716.89
8.0.100.0050.00216.89
8.0.90.0050.00216.75
8.0.80.0130.00316.95
8.0.70.0040.00416.78
8.0.60.0050.00316.90
8.0.50.0040.00416.78
8.0.30.0150.00817.12
8.0.20.0090.00917.17
8.0.10.0060.00316.82
8.0.00.0090.01116.87
7.4.330.0020.00213.00
7.4.320.0000.00616.59
7.4.300.0000.00616.59
7.4.290.0050.00216.57
7.4.280.0070.00016.54
7.4.270.0040.00416.55
7.4.260.0000.00513.23
7.4.250.0000.00816.51
7.4.240.0000.00716.55
7.4.230.0030.00316.64
7.4.220.0150.00616.41
7.4.210.0090.00716.54
7.4.200.0040.00416.68
7.4.190.0030.00316.63
7.4.160.0090.00616.56
7.4.150.0070.01016.49
7.4.140.0080.00916.43
7.4.130.0090.00816.62
7.4.120.0050.01216.50
7.4.110.0120.00616.57
7.4.100.0110.00716.62
7.4.90.0150.00316.58
7.4.80.0090.00916.46
7.4.70.0090.00916.54
7.4.60.0030.01516.48
7.4.50.0020.00216.32
7.4.40.0110.00316.59
7.4.30.0130.01016.54
7.4.00.0030.01414.72
7.3.330.0070.00013.16
7.3.320.0050.00013.30
7.3.310.0030.00316.40
7.3.300.0070.00016.42
7.3.290.0060.00916.45
7.3.280.0080.00816.38
7.3.270.0040.01316.46
7.3.260.0110.00616.41
7.3.250.0110.00716.65
7.3.240.0130.00316.39
7.3.230.0090.01216.64
7.3.210.0040.01216.58
7.3.200.0100.00719.39
7.3.190.0200.00616.50
7.3.180.0100.00616.32
7.3.170.0100.00816.50
7.3.160.0060.00916.35
7.3.120.0040.00815.16
7.2.330.0090.00916.71
7.2.320.0130.00316.71
7.2.310.0160.00316.72
7.2.300.0090.00916.86
7.2.290.0070.01316.51
7.2.60.0120.00416.88
7.2.00.0040.01119.50
7.1.200.0100.00315.63
7.1.100.0040.00717.93
7.1.70.0000.01017.14
7.1.60.0110.01419.40
7.1.50.0100.01416.95
7.1.00.0070.06322.48
7.0.200.0300.00914.90
7.0.140.0030.07321.98
7.0.120.0030.06022.17
7.0.60.0070.08320.04
7.0.50.0100.07317.74
7.0.40.0030.07720.09
7.0.30.0370.06720.29
7.0.20.0330.05020.33
7.0.10.0270.06020.05
7.0.00.0030.07320.09
5.6.280.0000.07721.11
5.6.210.0070.07020.68
5.6.200.0100.08018.22
5.6.190.0030.07320.78
5.6.180.0300.05320.64
5.6.170.0270.05320.47
5.6.160.0070.08320.46
5.6.150.0100.07318.14
5.6.140.0030.05318.21
5.6.130.0100.04718.18
5.6.120.0100.08021.06
5.6.110.0100.07721.00
5.6.100.0100.07721.14
5.6.90.0100.06020.89
5.6.80.0170.04020.50
5.6.70.4430.03720.54
5.5.350.0400.06320.43
5.5.340.0100.08017.99
5.5.330.0070.04020.13
5.5.320.0230.07720.47
5.5.310.0300.07720.30
5.5.300.0030.08718.10
5.5.290.0070.07717.98
5.5.280.0070.08020.80
5.5.270.0030.06720.80
5.5.260.0170.07320.88
5.5.250.0070.07720.73
5.5.240.0000.07020.28
5.4.450.0130.06319.20
5.4.440.0030.04319.57
5.4.430.0030.04319.56
5.4.420.0170.05019.17
5.4.410.0070.03719.05
5.4.400.0030.04318.86
5.4.390.0100.07019.00
5.4.380.0070.05019.15
5.4.370.0100.06018.92
5.4.360.0100.07019.01
5.4.350.0070.03719.09
5.4.340.0200.06318.87
5.4.320.0100.04718.85
5.4.310.0170.06319.14
5.4.300.0030.05319.14
5.4.290.0100.04319.00
5.4.280.0100.07319.00
5.4.270.0130.04718.92
5.4.260.0200.06318.84
5.4.250.0100.04719.23
5.4.240.0130.06719.23
5.4.230.0100.05718.85
5.4.220.0100.06719.14
5.4.210.0070.05718.85
5.4.200.0030.05019.24
5.4.190.0030.04018.84
5.4.180.0070.05318.84
5.4.170.0030.05019.24
5.4.160.0070.04719.21
5.4.150.0070.07318.84
5.4.140.0070.05316.43
5.4.130.0100.04716.32
5.4.120.0030.08316.43
5.4.110.0030.05016.42
5.4.100.0030.04716.42
5.4.90.0100.06316.45
5.4.80.0070.03716.31
5.4.70.0100.07016.59
5.4.60.0130.06016.50
5.4.50.0030.04016.36
5.4.40.0030.07316.65
5.4.30.0000.06716.42
5.4.20.0030.04016.40
5.4.10.0030.05016.43
5.4.00.0030.04315.78
5.3.290.0030.04014.75
5.3.280.0030.07714.67
5.3.270.0070.06314.63
5.3.260.0030.07014.67
5.3.250.0030.06714.68
5.3.240.0070.04014.62
5.3.230.0030.08314.66
5.3.220.0030.07314.60
5.3.210.0000.07314.50
5.3.200.0100.06014.61
5.3.190.0070.07714.62
5.3.180.0070.04314.58
5.3.170.0030.03714.61
5.3.160.0030.07714.73
5.3.150.0100.04314.47
5.3.140.0130.07314.59
5.3.130.0070.04714.61
5.3.120.0070.06714.57
5.3.110.0030.08014.59
5.3.100.0070.05713.94
5.3.90.0030.05014.04
5.3.80.0170.02714.11
5.3.70.0130.06714.13
5.3.60.0100.05714.05
5.3.50.0030.05313.98
5.3.40.0000.04313.99
5.3.30.0030.03713.96
5.3.20.0070.04013.63
5.3.10.0100.03013.71
5.3.00.0100.06313.83
5.2.170.0070.04711.18
5.2.160.0000.04011.13
5.2.150.0000.04011.18
5.2.140.0030.03711.22
5.2.130.0030.03011.28
5.2.120.0000.03311.20
5.2.110.0000.03711.18
5.2.100.0030.03011.04
5.2.90.0030.04311.18
5.2.80.0100.04011.26
5.2.70.0000.03711.29
5.2.60.0030.03011.07
5.2.50.0130.03710.93
5.2.40.0170.04310.98
5.2.30.0070.05710.98
5.2.20.0170.04710.92
5.2.10.0100.06310.88
5.2.00.0100.03310.90
5.1.60.0130.0279.99
5.1.50.0000.0339.97
5.1.40.0030.05310.06
5.1.30.0030.05710.41
5.1.20.0070.04710.42
5.1.10.0100.04310.00
5.1.00.0070.04010.06
5.0.50.0070.0308.55
5.0.40.0070.0208.52
5.0.30.0030.0578.26
5.0.20.0030.0478.16
5.0.10.0030.0308.18
5.0.00.0030.0678.26
4.4.90.0030.0338.16
4.4.80.0030.0338.16
4.4.70.0000.0408.16
4.4.60.0070.0108.16
4.4.50.0000.0378.16
4.4.40.0030.0308.16
4.4.30.0000.0208.16
4.4.20.0030.0378.16
4.4.10.0070.0338.16
4.4.00.0070.0538.16
4.3.110.0000.0178.16
4.3.100.0030.0338.16
4.3.90.0030.0178.16
4.3.80.0030.0278.16
4.3.70.0000.0378.16
4.3.60.0070.0278.16
4.3.50.0030.0208.16
4.3.40.0000.0378.16
4.3.30.0030.0378.16
4.3.20.0000.0308.16
4.3.10.0030.0308.16
4.3.00.0030.0278.16

preferences:
53.63 ms | 401 KiB | 5 Q