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 = 0xFFFFFFFF00000000 | $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(is32Bit(), unpack_int32("\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.0070.01318.41
8.3.50.0120.00521.26
8.3.40.0180.00019.01
8.3.30.0110.00418.66
8.3.20.0040.00418.77
8.3.10.0000.00920.66
8.3.00.0080.00023.64
8.2.180.0110.01116.63
8.2.170.0110.00322.96
8.2.160.0120.00620.35
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0030.00619.43
8.2.110.0190.00320.46
8.2.100.0040.00817.91
8.2.90.0000.00719.22
8.2.80.0050.00317.97
8.2.70.0090.00717.50
8.2.60.0030.00717.93
8.2.50.0060.00618.07
8.2.40.0040.00418.16
8.2.30.0040.00419.82
8.2.20.0030.00517.76
8.2.10.0040.00417.77
8.2.00.0000.00817.66
8.1.280.0040.01125.92
8.1.270.0040.00423.99
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0000.01022.61
8.1.230.0070.00420.96
8.1.220.0040.00418.77
8.1.210.0030.00618.95
8.1.200.0030.00617.35
8.1.190.0000.00817.53
8.1.180.0000.00818.10
8.1.170.0080.00018.74
8.1.160.0070.00018.98
8.1.150.0000.00818.62
8.1.140.0040.00417.47
8.1.130.0030.00317.93
8.1.120.0070.00017.64
8.1.110.0040.00417.48
8.1.100.0030.00617.52
8.1.90.0000.00817.53
8.1.80.0040.00417.59
8.1.70.0050.00217.48
8.1.60.0040.00417.71
8.1.50.0040.00417.45
8.1.40.0000.00817.69
8.1.30.0040.00417.68
8.1.20.0040.00417.65
8.1.10.0060.00317.60
8.1.00.0040.00417.59
8.0.300.0040.00420.14
8.0.290.0000.00717.41
8.0.280.0000.00818.57
8.0.270.0070.00017.27
8.0.260.0000.00816.92
8.0.250.0040.00417.03
8.0.240.0070.00317.03
8.0.230.0040.00417.02
8.0.220.0030.00317.00
8.0.210.0000.00816.94
8.0.200.0000.00717.10
8.0.190.0000.00717.05
8.0.180.0000.00717.07
8.0.170.0040.00417.00
8.0.160.0040.00416.98
8.0.150.0040.00416.86
8.0.140.0000.00716.98
8.0.130.0030.00313.38
8.0.120.0040.00416.89
8.0.110.0020.00517.00
8.0.100.0040.00417.05
8.0.90.0040.00416.94
8.0.80.0040.01116.98
8.0.70.0040.00416.98
8.0.60.0000.00716.91
8.0.50.0000.00716.93
8.0.30.0090.01017.43
8.0.20.0090.00917.40
8.0.10.0050.00217.14
8.0.00.0110.00716.92
7.4.330.0000.00713.43
7.4.320.0080.00016.61
7.4.300.0000.00716.70
7.4.290.0070.00016.68
7.4.280.0070.00016.71
7.4.270.0030.00316.73
7.4.260.0000.00513.39
7.4.250.0040.00416.60
7.4.240.0000.00816.59
7.4.230.0040.00416.43
7.4.220.0100.00716.77
7.4.210.0080.00716.67
7.4.200.0000.00716.51
7.4.190.0000.00816.55
7.4.160.0140.00316.52
7.4.150.0090.01217.40
7.4.140.0100.00717.86
7.4.130.0100.01016.64
7.4.120.0100.00716.65
7.4.110.0070.01416.64
7.4.100.0070.01316.80
7.4.90.0100.01016.58
7.4.80.0120.00619.04
7.4.70.0070.01816.73
7.4.60.0120.00616.41
7.4.50.0000.00616.65
7.4.40.0000.01222.27
7.4.30.0030.01416.73
7.4.00.0040.01415.05
7.3.330.0000.00613.34
7.3.320.0000.00613.43
7.3.310.0030.00316.29
7.3.300.0000.00716.50
7.3.290.0100.00316.48
7.3.280.0030.01216.43
7.3.270.0100.00717.40
7.3.260.0070.01118.24
7.3.250.0150.00516.45
7.3.240.0040.01416.61
7.3.230.0140.00416.68
7.3.210.0110.00616.73
7.3.200.0120.00919.39
7.3.190.0060.01116.52
7.3.180.0070.01016.73
7.3.170.0120.00316.47
7.3.160.0130.00316.57
7.3.120.0120.00314.97
7.3.10.0120.00016.80
7.3.00.0030.01016.71
7.2.330.0030.01516.55
7.2.320.0100.00716.53
7.2.310.0070.01616.59
7.2.300.0170.00016.77
7.2.290.0120.00816.66
7.2.130.0060.01016.60
7.2.120.0000.00916.93
7.2.110.0090.00616.86
7.2.100.0040.01216.94
7.2.90.0070.00716.72
7.2.80.0110.00417.04
7.2.70.0030.01316.93
7.2.60.0060.01216.96
7.2.50.0060.00716.67
7.2.40.0060.00617.04
7.2.30.0030.01017.06
7.2.20.0070.00716.99
7.2.10.0080.00416.88
7.2.00.0080.00516.90
7.1.250.0040.00415.79
7.1.70.0000.01117.26
7.1.60.0000.02519.40
7.1.50.0030.01917.10
7.1.00.0000.03722.36
7.0.200.0040.00416.91
7.0.140.0030.07022.18
7.0.60.0070.08020.04
7.0.50.0030.08318.05
7.0.40.0070.07717.85
7.0.30.0100.04017.87
7.0.20.0100.08717.98
7.0.10.0100.07317.89
7.0.00.0100.03717.97
5.6.280.0000.07721.09
5.6.210.0130.07720.57
5.6.200.0070.08318.25
5.6.190.0030.08318.41
5.6.180.0170.06718.36
5.6.170.0130.04718.30
5.6.160.0030.04018.32
5.6.150.0130.07718.25
5.6.140.0100.05718.35
5.6.130.0070.07318.30
5.6.120.0100.04718.33
5.6.110.0030.06718.26
5.6.100.0100.07018.27
5.6.90.0130.05718.23
5.6.80.0100.07717.73
5.6.70.0030.08017.67
5.6.60.0100.04717.73
5.6.50.0030.05717.70
5.6.40.0030.06317.69
5.6.30.0100.03317.65
5.6.20.0130.06717.70
5.6.10.0030.04017.70
5.6.00.0100.03317.59
5.5.350.4070.04720.46
5.5.340.0100.07718.04
5.5.330.0070.07718.07
5.5.320.0070.06318.06
5.5.310.0100.08018.11
5.5.300.0130.07318.11
5.5.290.0100.07718.21
5.5.280.0000.08318.04
5.5.270.0000.07018.11
5.5.260.0070.07318.10
5.5.250.0000.08017.89
5.5.240.0130.07317.56
5.5.230.0100.06317.59
5.5.220.0100.07717.48
5.5.210.0100.07317.51
5.5.200.0000.04317.56
5.5.190.0000.05317.57
5.5.180.0030.08017.46
5.5.160.0070.04317.43
5.5.150.0070.06317.50
5.5.140.0100.07717.42
5.5.130.0030.04317.49
5.5.120.0100.07717.46
5.5.110.0070.04717.38
5.5.100.0000.07317.41
5.5.90.0070.06717.29
5.5.80.0100.07017.32
5.5.70.0030.05317.42
5.5.60.0030.06717.32
5.5.50.0000.08017.29
5.5.40.0070.04717.38
5.5.30.0070.05017.26
5.5.20.0030.08317.38
5.5.10.0000.08017.30
5.5.00.0070.07317.34
5.4.450.0030.06019.39
5.4.440.0070.05019.37
5.4.430.0000.06319.42
5.4.420.0070.04019.34
5.4.410.0100.07719.25
5.4.400.0070.03719.02
5.4.390.0070.08019.08
5.4.380.0070.07019.09
5.4.370.0070.08018.96
5.4.360.0070.03719.14
5.4.350.0070.03719.27
5.4.340.0070.06318.99
5.4.320.0070.05019.02
5.4.310.0170.07018.99
5.4.300.0100.04319.03
5.4.290.0100.07719.14
5.4.280.0130.07319.00
5.4.270.0070.08019.05
5.4.260.0070.07319.04
5.4.250.0100.07719.01
5.4.240.0070.07719.09
5.4.230.0070.07019.09
5.4.220.0070.07319.03
5.4.210.0100.07319.09
5.4.200.0070.03719.02
5.4.190.0130.07719.26
5.4.180.0070.04719.12
5.4.170.0070.07718.97
5.4.160.0070.05319.03
5.4.150.0000.05018.96
5.4.140.0070.04316.52
5.4.130.0100.06716.41
5.4.120.0170.06316.59
5.4.110.0000.06016.54
5.4.100.0030.06716.47
5.4.90.0070.07316.40
5.4.80.0070.05716.42
5.4.70.0070.07716.51
5.4.60.0100.05016.46
5.4.50.0030.07316.32
5.4.40.0070.03716.41
5.4.30.0000.08016.38
5.4.20.0030.07716.53
5.4.10.0030.08016.38
5.4.00.0100.06715.78
5.3.290.0070.07714.69
5.3.280.0170.05014.46
5.3.270.0030.06714.67
5.3.260.0070.06714.66
5.3.250.0030.06014.47
5.3.240.0100.04314.59
5.3.230.0070.05314.60
5.3.220.0030.07314.62
5.3.210.0100.06714.61
5.3.200.0130.07014.57
5.3.190.0070.07014.61
5.3.180.0100.06714.63
5.3.170.0070.05314.63
5.3.160.0030.07314.63
5.3.150.0070.07314.65
5.3.140.0000.07714.63
5.3.130.0070.08014.61
5.3.120.0000.08014.61
5.3.110.0030.07714.55
5.3.100.0130.06714.07
5.3.90.0130.06714.09
5.3.80.0130.04314.01
5.3.70.0030.04314.02
5.3.60.0030.07713.86
5.3.50.0000.05313.97
5.3.40.0070.05713.80
5.3.30.0030.07314.14
5.3.20.0030.07313.80
5.3.10.0000.04713.71
5.3.00.0000.07013.68
5.2.170.0070.03711.23
5.2.160.0070.06311.15
5.2.150.0030.06311.20
5.2.140.0070.02711.20
5.2.130.0070.06011.17
5.2.120.0070.03711.14
5.2.110.0030.06011.11
5.2.100.0070.05311.18
5.2.90.0030.06711.13
5.2.80.0030.06311.22
5.2.70.0030.06711.19
5.2.60.0130.04311.05
5.2.50.0000.06711.11
5.2.40.0100.03711.07
5.2.30.0100.03311.09
5.2.20.0030.05711.02
5.2.10.0100.04311.10
5.2.00.0030.04010.75
5.1.60.0100.04710.11
5.1.50.0070.05310.00
5.1.40.0000.0279.98
5.1.30.0070.05010.41
5.1.20.0000.04310.38
5.1.10.0030.04310.18
5.1.00.0100.04710.09
5.0.50.0030.0478.44
5.0.40.0000.0238.35
5.0.30.0000.0638.25
5.0.20.0000.0478.19
5.0.10.0030.0438.18
5.0.00.0030.0478.16
4.4.90.0070.0337.72
4.4.80.0000.0207.72
4.4.70.0070.0307.72
4.4.60.0000.0277.72
4.4.50.0000.0237.72
4.4.40.0030.0537.72
4.4.30.0000.0207.72
4.4.20.0000.0407.72
4.4.10.0070.0337.72
4.4.00.0000.0477.72
4.3.110.0000.0307.72
4.3.100.0070.0337.72
4.3.90.0030.0337.72
4.3.80.0000.0577.72
4.3.70.0000.0207.72
4.3.60.0000.0407.72
4.3.50.0030.0177.72
4.3.40.0000.0237.72
4.3.30.0000.0177.72
4.3.20.0000.0237.72
4.3.10.0000.0177.72
4.3.00.0000.0207.72

preferences:
62.9 ms | 400 KiB | 5 Q