3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('INT_SIGNED', 1); define('INT_LE', 2); 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 = current(unpack('N', $str)); $signBit = (bool) ($result & 0x80000000); $isSigned = (bool) ($flags & INT_SIGNED); $is32bit = PHP_INT_MAX < 0x80000000; 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); } $is32bit = PHP_INT_MAX < 0x80000000; 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 (PHP_INT_MAX > 0x7FFFFFFF) { $result = ($longs[0] << 32) | $longs[1]; if ($signBit) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } return $result; } var_dump(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.0060.00916.75
8.3.50.0060.01117.24
8.3.40.0100.00718.79
8.3.30.0040.01118.71
8.3.20.0040.00418.45
8.3.10.0040.00418.91
8.3.00.0030.00619.38
8.2.180.0140.00716.88
8.2.170.0110.00722.96
8.2.160.0150.00021.18
8.2.150.0080.00024.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0040.00420.90
8.2.110.0080.00421.00
8.2.100.0080.00417.84
8.2.90.0060.00319.70
8.2.80.0000.00818.03
8.2.70.0050.00317.93
8.2.60.0060.00318.22
8.2.50.0040.00818.10
8.2.40.0040.00419.39
8.2.30.0000.00819.22
8.2.20.0060.00319.53
8.2.10.0070.00017.85
8.2.00.0040.00417.81
8.1.280.0110.00725.92
8.1.270.0000.00823.99
8.1.260.0050.00326.35
8.1.250.0030.00528.09
8.1.240.0030.00623.92
8.1.230.0040.00722.75
8.1.220.0090.00017.77
8.1.210.0000.00918.77
8.1.200.0000.01117.36
8.1.190.0060.00317.35
8.1.180.0080.00018.10
8.1.170.0000.00918.60
8.1.160.0000.00718.97
8.1.150.0080.00018.91
8.1.140.0030.00517.55
8.1.130.0070.00017.91
8.1.120.0000.00717.57
8.1.110.0000.00717.57
8.1.100.0000.00717.49
8.1.90.0040.00417.43
8.1.80.0000.00817.54
8.1.70.0030.00317.48
8.1.60.0070.00017.58
8.1.50.0030.00617.44
8.1.40.0030.00517.51
8.1.30.0000.00917.75
8.1.20.0040.00417.68
8.1.10.0040.00417.45
8.1.00.0070.00417.52
8.0.300.0040.00419.77
8.0.290.0040.00416.88
8.0.280.0000.00718.45
8.0.270.0030.00317.32
8.0.260.0060.00016.79
8.0.250.0040.00416.96
8.0.240.0050.00316.98
8.0.230.0000.00716.95
8.0.220.0070.00016.88
8.0.210.0070.00016.99
8.0.200.0030.00317.04
8.0.190.0030.00317.04
8.0.180.0070.00016.98
8.0.170.0040.00417.03
8.0.160.0070.00017.01
8.0.150.0040.00416.83
8.0.140.0030.00616.91
8.0.130.0030.00313.44
8.0.120.0040.00416.82
8.0.110.0070.00016.94
8.0.100.0070.00017.05
8.0.90.0080.00016.79
8.0.80.0060.00916.89
8.0.70.0080.00016.89
8.0.60.0040.00416.99
8.0.50.0040.00416.89
8.0.30.0090.00917.10
8.0.20.0180.01017.04
8.0.10.0050.00217.10
8.0.00.0120.00516.82
7.4.330.0000.00513.03
7.4.320.0060.00016.56
7.4.300.0060.00016.72
7.4.290.0040.00416.65
7.4.280.0030.00516.57
7.4.270.0080.00016.68
7.4.260.0060.00013.38
7.4.250.0060.00316.71
7.4.240.0030.00416.53
7.4.230.0000.00716.48
7.4.220.0150.00416.59
7.4.210.0070.01016.68
7.4.200.0000.00716.35
7.4.190.0040.00416.76
7.4.160.0090.00616.59
7.4.150.0120.00616.50
7.4.140.0110.00816.72
7.4.130.0080.00916.56
7.4.120.0080.01216.53
7.4.110.0070.01016.59
7.4.100.0090.01416.70
7.4.90.0120.00616.61
7.4.80.0080.00819.39
7.4.70.0100.00716.62
7.4.60.0070.01116.58
7.4.50.0120.00016.68
7.4.40.0080.00416.58
7.4.30.0090.00616.76
7.4.00.0090.00914.92
7.3.330.0070.00013.51
7.3.320.0030.00313.51
7.3.310.0000.00816.39
7.3.300.0030.00316.48
7.3.290.0040.01116.45
7.3.280.0090.00716.42
7.3.270.0110.00716.62
7.3.260.0130.00316.45
7.3.250.0100.01016.52
7.3.240.0080.01516.45
7.3.230.0060.01016.40
7.3.210.0070.01016.78
7.3.200.0110.00716.48
7.3.190.0090.00916.73
7.3.180.0090.00616.43
7.3.170.0100.00716.55
7.3.160.0120.00816.41
7.3.120.0110.00614.79
7.3.110.0070.01114.73
7.3.100.0060.00614.70
7.3.90.0030.00714.88
7.3.80.0030.00815.08
7.3.70.0000.01214.80
7.3.60.0000.01814.96
7.3.50.0150.00314.91
7.3.40.0070.01015.01
7.3.30.0070.00715.02
7.3.20.0070.00716.87
7.3.10.0110.00416.94
7.3.00.0100.00716.87
7.2.330.0100.01016.46
7.2.320.0100.01016.69
7.2.310.0190.00416.56
7.2.300.0070.01416.63
7.2.290.0100.00716.89
7.2.250.0150.00315.31
7.2.240.0070.01315.37
7.2.230.0030.00615.38
7.2.220.0080.00815.05
7.2.210.0070.00714.95
7.2.200.0070.00315.23
7.2.190.0030.01315.13
7.2.180.0030.00915.10
7.2.170.0040.00715.20
7.2.00.0070.00719.46
7.1.330.0040.01215.75
7.1.320.0000.01316.00
7.1.310.0000.00916.05
7.1.300.0090.00615.98
7.1.290.0110.00615.98
7.1.280.0080.00415.88
7.1.270.0030.01215.87
7.1.260.0130.00315.93
7.1.100.0180.00918.15
7.1.70.0000.00717.30
7.1.60.0130.01319.40
7.1.50.0100.01316.75
7.1.00.0030.07722.66
7.0.200.0060.01015.18
7.0.140.0100.06722.21
7.0.120.0030.03322.21
7.0.60.0030.08721.97
7.0.50.0030.07018.01
7.0.40.0030.04320.26
7.0.30.0370.05020.34
7.0.20.0170.04720.29
7.0.10.0100.04020.33
7.0.00.0170.07320.25
5.6.210.0030.08720.86
5.6.200.0100.08318.34
5.6.190.0030.08320.56
5.6.180.0270.06020.39
5.6.170.0300.08320.54
5.6.160.0130.06720.66
5.6.150.0070.08018.28
5.6.140.0070.05318.24
5.6.130.0070.08318.23
5.6.120.0070.08721.23
5.6.110.0100.07721.08
5.6.100.0100.04721.07
5.6.90.0030.04021.16
5.6.80.0070.05020.55
5.5.350.0030.08720.53
5.5.340.0100.07718.07
5.5.330.0170.07020.19
5.5.320.0270.08020.48
5.5.310.0230.03720.50
5.5.300.0130.06718.07
5.5.290.0030.04318.16
5.5.280.0130.08020.89
5.5.270.0000.04721.07
5.5.260.0070.07720.87
5.5.250.0070.08720.72
5.5.240.0270.06720.37
5.4.450.0070.07319.34
5.4.440.0130.07719.47
5.4.430.0100.06719.50
5.4.420.0070.04319.46
5.4.410.0130.04719.08
5.4.400.0130.06319.15
5.4.390.0100.03318.87
5.4.380.0100.07718.97
5.4.370.0070.05319.14
5.4.360.0170.03319.16
5.4.350.0000.07719.05
5.4.340.0070.08019.16
5.4.320.0070.04318.98
5.4.310.0070.05019.15
5.4.300.0070.04319.19
5.4.290.0030.06718.85
5.4.280.0030.04019.12
5.4.270.0100.06319.23
5.4.260.0170.06718.87
5.4.250.0030.04018.92
5.4.240.0070.04018.91
5.4.230.0130.07318.86
5.4.220.0070.07319.07
5.4.210.0070.07019.23
5.4.200.0270.02719.07
5.4.190.0070.06019.14
5.4.180.0070.03718.84
5.4.170.0070.03719.13
5.4.160.0000.08019.13
5.4.150.0030.07318.96
5.4.140.0070.05716.39
5.4.130.0070.05316.40
5.4.120.0000.04016.46
5.4.110.0130.07016.48
5.4.100.0030.03716.48
5.4.90.0070.06016.38
5.4.80.0070.08016.34
5.4.70.0070.07016.51
5.4.60.0100.06316.37
5.4.50.0030.07716.39
5.4.40.0030.03716.36
5.4.30.0100.06716.43
5.4.20.0100.04716.27
5.4.10.0030.06016.34
5.4.00.0030.07315.82
5.3.290.0070.07714.70
5.3.280.0130.05714.62
5.3.270.0030.04014.67
5.3.260.0030.08314.77
5.3.250.0170.03014.63
5.3.240.0100.06714.61
5.3.230.0070.03714.61
5.3.220.0030.04714.63
5.3.210.0130.06014.57
5.3.200.0070.03314.58
5.3.190.0100.04714.62
5.3.180.0100.07314.57
5.3.170.0070.05014.60
5.3.160.0000.04014.58
5.3.150.0070.07314.56
5.3.140.0070.07314.50
5.3.130.0100.07714.63
5.3.120.0200.05714.55
5.3.110.0070.08014.44
5.3.100.0070.05714.20
5.3.90.0100.07313.95
5.3.80.0130.06714.00
5.3.70.0000.05314.19
5.3.60.0030.05714.05
5.3.50.0030.04713.88
5.3.40.0000.08013.96
5.3.30.0130.04713.91
5.3.20.0030.07313.72
5.3.10.0030.05013.58
5.3.00.0000.05013.71
5.2.170.0030.03711.25
5.2.160.0070.05311.33
5.2.150.0070.06311.23
5.2.140.0100.03311.31
5.2.130.0070.04311.13
5.2.120.0070.06011.09
5.2.110.0030.05011.13
5.2.100.0030.04011.02
5.2.90.0030.06711.19
5.2.80.0070.06711.08
5.2.70.0030.05311.15
5.2.60.0000.04011.23
5.2.50.0070.03711.04
5.2.40.0030.06711.16
5.2.30.0100.05711.00
5.2.20.0100.05311.04
5.2.10.0100.05310.88
5.2.00.0000.03310.64
5.1.60.0070.02010.07
5.1.50.0000.02710.00
5.1.40.0000.04310.07
5.1.30.0100.05010.37
5.1.20.0000.06010.37
5.1.10.0200.04010.24
5.1.00.0030.03310.02
5.0.50.0030.0378.80
5.0.40.0070.0138.80
5.0.30.0070.0438.80
5.0.20.0000.0238.80
5.0.10.0000.0208.80
5.0.00.0000.0338.80
4.4.90.0000.0208.80
4.4.80.0030.0178.80
4.4.70.0000.0208.80
4.4.60.0000.0178.80
4.4.50.0000.0208.80
4.4.40.0000.0408.80
4.4.30.0030.0378.80
4.4.20.0030.0338.80
4.4.10.0070.0308.80
4.4.00.0000.0278.80
4.3.110.0000.0178.80
4.3.100.0000.0178.80
4.3.90.0030.0138.80
4.3.80.0000.0238.80
4.3.70.0030.0138.80
4.3.60.0070.0108.80
4.3.50.0000.0138.80
4.3.40.0030.0208.80
4.3.30.0000.0178.80
4.3.20.0000.0178.80
4.3.10.0030.0138.80
4.3.00.0000.0138.80

preferences:
54.23 ms | 401 KiB | 5 Q