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('NN', substr($str, 0, 4), substr($str, 4, 4))); $signBit = (bool) ($longs[0] & 0x80000000); if (!is32Bit()) { $result = ($longs[0] << 32) | $longs[1]; if ($signBit) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } return $result; } var_dump(unpack_int64("\xFF\xFF\xFF\xFF\x81\x00\x00\x80", INT_SIGNED | INT_LE));

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.0190.00018.39
8.3.50.0140.00521.93
8.3.40.0110.01118.98
8.3.30.0110.00419.11
8.3.20.0000.00720.29
8.3.10.0110.00422.10
8.3.00.0080.00022.32
8.2.180.0100.01318.57
8.2.170.0090.00622.96
8.2.160.0140.00021.02
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00419.61
8.2.110.0030.00621.05
8.2.100.0090.00317.91
8.2.90.0040.00417.75
8.2.80.0040.00418.77
8.2.70.0080.00017.63
8.2.60.0110.00017.80
8.2.50.0000.00918.07
8.2.40.0030.00518.22
8.2.30.0000.01218.10
8.2.20.0040.00417.73
8.2.10.0040.00417.83
8.2.00.0000.00817.65
8.1.280.0180.00425.92
8.1.270.0000.00723.83
8.1.260.0040.00426.35
8.1.250.0060.01328.09
8.1.240.0070.00323.73
8.1.230.0110.00020.96
8.1.220.0060.00318.61
8.1.210.0050.00318.77
8.1.200.0080.00417.36
8.1.190.0090.00017.66
8.1.180.0050.00318.10
8.1.170.0060.00318.59
8.1.160.0060.00322.10
8.1.150.0030.00518.63
8.1.140.0040.00417.48
8.1.130.0070.00017.87
8.1.120.0000.00817.50
8.1.110.0020.00517.51
8.1.100.0000.00717.42
8.1.90.0040.00417.52
8.1.80.0050.00317.48
8.1.70.0030.00517.35
8.1.60.0040.00417.63
8.1.50.0000.00817.61
8.1.40.0000.00817.54
8.1.30.0040.00417.62
8.1.20.0080.00017.62
8.1.10.0040.00417.61
8.1.00.0050.00517.51
8.0.300.0000.00720.16
8.0.290.0030.00616.88
8.0.280.0030.00318.48
8.0.270.0000.00817.24
8.0.260.0030.00316.88
8.0.250.0070.00017.07
8.0.240.0040.00317.00
8.0.230.0000.00817.06
8.0.220.0030.00316.96
8.0.210.0020.00517.00
8.0.200.0000.00617.10
8.0.190.0080.00017.11
8.0.180.0040.00417.05
8.0.170.0030.00617.08
8.0.160.0000.00716.99
8.0.150.0070.00016.84
8.0.140.0000.00816.96
8.0.130.0030.00313.44
8.0.120.0000.00817.02
8.0.110.0050.00216.88
8.0.100.0000.00716.91
8.0.90.0070.00016.96
8.0.80.0080.00817.04
8.0.70.0040.00416.94
8.0.60.0000.00717.11
8.0.50.0040.00416.94
8.0.30.0050.01717.33
8.0.20.0090.01117.40
8.0.10.0080.00017.03
8.0.00.0090.00816.88
7.4.330.0000.00515.05
7.4.320.0000.00616.61
7.4.300.0000.00616.62
7.4.290.0000.00716.58
7.4.280.0030.00316.52
7.4.270.0030.00316.52
7.4.260.0080.00016.63
7.4.250.0000.00716.61
7.4.240.0040.00416.55
7.4.230.0000.00716.45
7.4.220.0080.00916.64
7.4.210.0090.00516.63
7.4.200.0040.00416.64
7.4.190.0030.00316.78
7.4.160.0030.01316.54
7.4.150.0070.01017.40
7.4.140.0100.01317.86
7.4.130.0090.00916.56
7.4.120.0130.00416.72
7.4.110.0090.00916.68
7.4.100.0130.00616.66
7.4.90.0100.00716.41
7.4.80.0120.00619.39
7.4.70.0030.01616.54
7.4.60.0060.01316.49
7.4.50.0030.00316.52
7.4.40.0040.01222.77
7.4.30.0090.00616.61
7.4.00.0100.00314.80
7.3.330.0000.00513.36
7.3.320.0050.00013.38
7.3.310.0000.00716.34
7.3.300.0070.00016.27
7.3.290.0070.00716.41
7.3.280.0080.00816.40
7.3.270.0130.00617.40
7.3.260.0120.00616.27
7.3.250.0040.01416.51
7.3.240.0100.01016.54
7.3.230.0030.01316.44
7.3.210.0130.00316.68
7.3.200.0120.01219.39
7.3.190.0110.00916.37
7.3.180.0070.01016.43
7.3.170.0100.00716.66
7.3.160.0120.00416.45
7.3.120.0000.01515.01
7.3.10.0060.00916.68
7.3.00.0060.00616.40
7.2.330.0070.01016.71
7.2.320.0140.01016.78
7.2.310.0060.01216.67
7.2.300.0170.00016.83
7.2.290.0070.01016.54
7.2.130.0070.00717.07
7.2.120.0100.00316.90
7.2.110.0120.00316.68
7.2.100.0100.00716.93
7.2.90.0110.00316.79
7.2.80.0000.00916.77
7.2.70.0000.00917.00
7.2.60.0020.01216.80
7.2.50.0110.00417.11
7.2.40.0080.00816.80
7.2.30.0060.00617.00
7.2.20.0030.01016.92
7.2.10.0060.00916.71
7.2.00.0050.00818.00
7.1.250.0030.01015.96
7.1.200.0000.01315.91
7.1.100.0040.01118.18
7.1.70.0060.00617.21
7.1.60.0070.01119.82
7.1.50.0210.00317.09
7.1.00.0000.07722.30
7.0.200.0030.01016.79
7.0.140.0100.06722.00
7.0.100.0130.07320.07
7.0.90.0270.05020.06
7.0.80.0070.06019.95
7.0.70.0130.07719.96
7.0.60.0070.05719.96
7.0.50.0130.04020.38
7.0.40.0100.07020.05
7.0.30.0100.08020.10
7.0.20.0070.06720.10
7.0.10.0100.08020.14
7.0.00.0100.08320.16
5.6.280.0030.07320.87
5.6.250.0100.04720.73
5.6.240.0100.08720.71
5.6.230.0030.04720.55
5.6.220.0030.04720.51
5.6.210.0100.07020.78
5.6.200.0100.05321.07
5.6.190.0070.08321.09
5.6.180.0130.07721.04
5.6.170.0070.08720.98
5.6.160.0170.07321.05
5.6.150.0030.08321.07
5.6.140.0070.07321.12
5.6.130.0030.08321.15
5.6.120.0100.07321.09
5.6.110.0000.09321.04
5.6.100.0070.05021.13
5.6.90.0100.08721.03
5.6.80.0100.07720.42
5.6.70.0070.04320.46
5.6.60.0070.06720.46
5.6.50.0170.07720.54
5.6.40.0100.07720.38
5.6.30.0170.07020.55
5.6.20.0030.08320.36
5.6.10.0030.08020.42
5.6.00.0030.08020.49
5.5.380.0030.08020.41
5.5.370.0070.06020.52
5.5.360.0100.08320.43
5.5.350.0100.05020.44
5.5.340.0070.05720.92
5.5.330.0100.04720.84
5.5.320.0100.07020.88
5.5.310.0100.07320.91
5.5.300.0100.08020.85
5.5.290.0070.05720.94
5.5.280.0000.05020.89
5.5.270.0130.06720.81
5.5.260.0130.07720.88
5.5.250.0000.07720.71
5.5.240.0100.07320.30
5.5.230.0100.08020.31
5.5.220.0100.07320.32
5.5.210.0070.07020.28
5.5.200.0000.06320.20
5.5.190.0130.06720.13
5.5.180.0030.05020.16
5.5.160.0130.03720.29
5.5.150.0230.03720.25
5.5.140.0070.08020.27
5.5.130.0070.08020.09
5.5.120.0100.04320.29
5.5.110.0130.07320.27
5.5.100.0170.07319.98
5.5.90.0070.07720.09
5.5.80.0100.07320.14
5.5.70.0130.07320.18
5.5.60.0130.03320.05
5.5.50.0170.06720.16
5.5.40.0030.05320.05
5.5.30.0030.07320.07
5.5.20.0030.04320.16
5.5.10.0130.07320.05
5.5.00.0000.04320.06
5.4.450.0100.08019.37
5.4.440.0030.06319.21
5.4.430.0030.08719.35
5.4.420.0030.04319.55
5.4.410.0000.07019.32
5.4.400.0130.07018.86
5.4.390.0170.04719.12
5.4.380.0130.04318.88
5.4.370.0070.07719.04
5.4.360.0170.07019.09
5.4.350.0070.06719.14
5.4.340.0070.08019.18
5.4.320.0030.08719.04
5.4.310.0130.06019.14
5.4.300.0130.08318.89
5.4.290.0100.07019.04
5.4.280.0030.05718.87
5.4.270.0070.05719.04
5.4.260.0100.06018.94
5.4.250.0100.07319.02
5.4.240.0100.07719.13
5.4.230.0000.07719.18
5.4.220.0070.07319.17
5.4.210.0130.06019.17
5.4.200.0030.07718.84
5.4.190.0100.07319.15
5.4.180.0000.04019.11
5.4.170.0030.04719.01
5.4.160.0070.06319.16
5.4.150.0100.05719.16
5.4.140.0000.08016.46
5.4.130.0000.04316.51
5.4.120.0170.05016.38
5.4.110.0200.05316.56
5.4.100.0030.06716.41
5.4.90.0030.06316.39
5.4.80.0070.07316.53
5.4.70.0130.07016.51
5.4.60.0030.04016.37
5.4.50.0170.06316.44
5.4.40.0130.07016.36
5.4.30.0070.04016.25
5.4.20.0070.07016.38
5.4.10.0030.06716.42
5.4.00.0030.08015.69
5.3.290.0170.06714.61
5.3.280.0030.04314.68
5.3.270.0070.07314.55
5.3.260.0130.07714.68
5.3.250.0070.07014.73
5.3.240.0030.07714.71
5.3.230.0070.04014.54
5.3.220.0170.06314.54
5.3.210.0030.04314.68
5.3.200.0100.08014.57
5.3.190.0130.07314.50
5.3.180.0070.07714.70
5.3.170.0100.04714.65
5.3.160.0100.03314.69
5.3.150.0030.08014.70
5.3.140.0070.08014.50
5.3.130.0030.04714.70
5.3.120.0070.07714.55
5.3.110.0100.07314.52
5.3.100.0030.06314.11
5.3.90.0100.07314.13
5.3.80.0030.06713.93
5.3.70.0170.06013.94
5.3.60.0100.05014.07
5.3.50.0100.07314.11
5.3.40.0030.07714.09
5.3.30.0070.07713.90
5.3.20.0070.04313.80
5.3.10.0100.03313.55
5.3.00.0070.04013.58
5.2.170.0070.06011.07
5.2.160.0070.05711.22
5.2.150.0070.06311.17
5.2.140.0130.05711.04
5.2.130.0030.03311.25
5.2.120.0030.03011.11
5.2.110.0070.05311.11
5.2.100.0030.06311.12
5.2.90.0030.06311.05
5.2.80.0070.05311.11
5.2.70.0100.05711.23
5.2.60.0000.04311.16
5.2.50.0030.07311.11
5.2.40.0070.03711.03
5.2.30.0030.03011.01
5.2.20.0030.06011.11
5.2.10.0000.05710.82
5.2.00.0070.04710.83
5.1.60.0070.0539.86
5.1.50.0100.04310.14
5.1.40.0030.03310.08
5.1.30.0030.05310.47
5.1.20.0000.04010.32
5.1.10.0100.05010.18
5.1.00.0070.02710.21
5.0.50.0000.0378.97
5.0.40.0000.0508.97
5.0.30.0030.0608.97
5.0.20.0070.0408.97
5.0.10.0070.0378.97
5.0.00.0030.0478.97
4.4.90.0030.0278.97
4.4.80.0030.0338.97
4.4.70.0030.0208.97
4.4.60.0000.0208.97
4.4.50.0000.0238.97
4.4.40.0030.0538.97
4.4.30.0000.0378.97
4.4.20.0070.0308.97
4.4.10.0070.0138.97
4.4.00.0000.0508.97
4.3.110.0030.0408.97
4.3.100.0070.0138.97
4.3.90.0030.0338.97
4.3.80.0030.0578.97
4.3.70.0030.0278.97
4.3.60.0030.0278.97
4.3.50.0030.0338.97
4.3.40.0100.0438.97
4.3.30.0070.0278.97
4.3.20.0000.0378.97
4.3.10.0000.0208.97
4.3.00.0000.0208.97

preferences:
56.45 ms | 401 KiB | 5 Q