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))); var_dump($longs); $signBit = (bool) ($longs[0] & 0x80000000); if (!is32Bit()) { var_dump($longs); $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.0040.01118.56
8.3.50.0090.00922.05
8.3.40.0080.00818.68
8.3.30.0110.00418.87
8.3.20.0060.00318.76
8.3.10.0040.00421.11
8.3.00.0040.00422.02
8.2.180.0090.00616.46
8.2.170.0140.00022.96
8.2.160.0110.00420.38
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0080.00026.16
8.2.120.0040.00419.36
8.2.110.0050.00520.35
8.2.100.0070.00417.72
8.2.90.0050.00317.97
8.2.80.0060.00317.97
8.2.70.0030.00517.38
8.2.60.0000.00817.91
8.2.50.0000.00918.07
8.2.40.0050.00317.96
8.2.30.0000.00819.64
8.2.20.0040.00417.47
8.2.10.0040.00417.57
8.2.00.0050.00317.62
8.1.280.0120.00625.92
8.1.270.0000.00823.99
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0030.00622.09
8.1.230.0040.00820.92
8.1.220.0000.00917.74
8.1.210.0000.00818.96
8.1.200.0060.00317.10
8.1.190.0050.00217.40
8.1.180.0040.00418.10
8.1.170.0040.00418.50
8.1.160.0040.00418.64
8.1.150.0050.00318.50
8.1.140.0030.00617.33
8.1.130.0070.00017.80
8.1.120.0000.00717.27
8.1.110.0060.00317.35
8.1.100.0080.00017.36
8.1.90.0050.00217.31
8.1.80.0030.00517.42
8.1.70.0000.00717.35
8.1.60.0000.01117.47
8.1.50.0030.00617.41
8.1.40.0040.00417.45
8.1.30.0040.00417.61
8.1.20.0030.00617.54
8.1.10.0040.00417.48
8.1.00.0090.00317.38
8.0.300.0030.00620.04
8.0.290.0030.00617.18
8.0.280.0070.00018.29
8.0.270.0070.00017.07
8.0.260.0030.00316.73
8.0.250.0040.00416.97
8.0.240.0000.00817.00
8.0.230.0030.00316.94
8.0.220.0030.00316.89
8.0.210.0030.00316.84
8.0.200.0060.00016.95
8.0.190.0040.00416.88
8.0.180.0080.00016.98
8.0.170.0050.00316.88
8.0.160.0090.00016.91
8.0.150.0040.00416.96
8.0.140.0030.00616.84
8.0.130.0030.00313.40
8.0.120.0040.00416.80
8.0.110.0000.00716.87
8.0.100.0040.00416.98
8.0.90.0000.00716.94
8.0.80.0060.00916.98
8.0.70.0000.00716.86
8.0.60.0000.00716.94
8.0.50.0030.00617.02
8.0.30.0130.01017.24
8.0.20.0090.00917.40
8.0.10.0080.00016.89
8.0.00.0080.01216.64
7.4.330.0050.00014.95
7.4.320.0030.00316.72
7.4.300.0000.00616.52
7.4.290.0040.00416.69
7.4.280.0080.00016.70
7.4.270.0000.00816.52
7.4.260.0000.00513.39
7.4.250.0060.00316.58
7.4.240.0030.00516.51
7.4.230.0070.00016.76
7.4.220.0060.01216.48
7.4.210.0060.01016.71
7.4.200.0030.00316.53
7.4.190.0000.01016.47
7.4.160.0140.01016.72
7.4.150.0060.01217.40
7.4.140.0100.00817.86
7.4.130.0080.00816.73
7.4.120.0100.01116.65
7.4.110.0070.01116.71
7.4.100.0030.01416.66
7.4.90.0130.00616.53
7.4.80.0150.00619.37
7.4.70.0090.00916.75
7.4.60.0030.01716.59
7.4.50.0000.00916.66
7.4.40.0070.01122.27
7.4.30.0090.00916.61
7.4.00.0060.01214.95
7.3.330.0050.00013.38
7.3.320.0000.00613.48
7.3.310.0040.00416.33
7.3.300.0050.00316.43
7.3.290.0030.01316.52
7.3.280.0100.00716.51
7.3.270.0180.00017.40
7.3.260.0080.00918.24
7.3.250.0120.00816.52
7.3.240.0100.00616.52
7.3.230.0030.01916.72
7.3.210.0170.00716.64
7.3.200.0090.00919.39
7.3.190.0110.00616.57
7.3.180.0090.00616.54
7.3.170.0060.00916.71
7.3.160.0040.01516.58
7.3.120.0030.01215.20
7.3.10.0040.00916.55
7.3.00.0070.00616.66
7.2.330.0030.01516.82
7.2.320.0130.00316.79
7.2.310.0130.00416.82
7.2.300.0110.00616.82
7.2.290.0140.00316.69
7.2.130.0050.00516.91
7.2.120.0070.00816.85
7.2.110.0060.00616.61
7.2.100.0040.00916.84
7.2.90.0030.01016.77
7.2.80.0060.00716.81
7.2.70.0030.00916.83
7.2.60.0030.01116.86
7.2.50.0080.00816.86
7.2.40.0050.00616.70
7.2.30.0060.00616.99
7.2.20.0030.01016.87
7.2.10.0030.00816.84
7.2.00.0040.00617.75
7.1.250.0070.00415.70
7.1.200.0040.00715.97
7.1.100.0080.00818.08
7.1.70.0030.00717.24
7.1.60.0060.01619.40
7.1.50.0110.00416.74
7.1.00.0100.05322.64
7.0.200.0000.00816.55
7.0.140.0070.07022.10
7.0.70.0030.08021.86
7.0.60.0030.08321.91
7.0.50.0000.07722.14
7.0.40.0100.08020.11
7.0.30.0100.06720.18
7.0.20.0070.07320.13
7.0.10.0100.07320.04
7.0.00.0030.08320.10
5.6.280.0030.07320.99
5.6.220.0000.09020.78
5.6.210.0100.07320.75
5.6.200.0070.08721.28
5.6.190.0100.07721.13
5.6.180.0070.08021.23
5.6.170.0070.07721.13
5.6.160.0130.07321.07
5.6.150.0070.07721.22
5.6.140.0030.06721.06
5.6.130.0030.09721.17
5.6.120.0130.08021.27
5.6.110.0100.08021.04
5.6.100.0070.07721.21
5.6.90.0100.07021.11
5.6.80.0070.07020.64
5.6.70.0030.08020.50
5.6.60.0070.07020.63
5.6.50.0130.07320.43
5.6.40.0000.07320.53
5.6.30.0070.07720.49
5.6.20.0030.08320.49
5.6.10.0030.07020.60
5.6.00.0000.08320.45
5.5.360.0030.06720.45
5.5.350.0030.08320.53
5.5.340.0030.07320.98
5.5.330.0100.06720.82
5.5.320.0070.08020.87
5.5.310.0100.06020.97
5.5.300.0100.06720.98
5.5.290.0070.07720.92
5.5.280.0000.07320.97
5.5.270.0030.07320.88
5.5.260.0070.07720.87
5.5.250.0070.07720.70
5.5.240.0070.07020.36
5.5.230.0100.07320.27
5.5.220.0030.05020.32
5.5.210.0000.08020.39
5.5.200.0130.06020.33
5.5.190.0070.07720.30
5.5.180.0130.07320.24
5.5.160.0100.06720.20
5.5.150.0100.07720.41
5.5.140.0100.06720.15
5.5.130.0030.07320.29
5.5.120.0070.06720.34
5.5.110.0070.07320.28
5.5.100.0030.07720.09
5.5.90.0030.07720.21
5.5.80.0030.05320.22
5.5.70.0070.07320.25
5.5.60.0000.06320.17
5.5.50.0070.03720.17
5.5.40.0000.07720.11
5.5.30.0070.06320.14
5.5.20.0030.07020.20
5.5.10.0070.08020.10
5.5.00.0070.04720.13
5.4.450.0100.07319.28
5.4.440.0070.07719.51
5.4.430.0100.05319.45
5.4.420.0100.07019.27
5.4.410.0070.06319.07
5.4.400.0030.07018.92
5.4.390.0070.07019.21
5.4.380.0000.07719.09
5.4.370.0030.08018.91
5.4.360.0030.07319.05
5.4.350.0070.07019.24
5.4.340.0070.07018.86
5.4.320.0000.06019.05
5.4.310.0130.07319.12
5.4.300.0100.06019.16
5.4.290.0030.06719.14
5.4.280.0070.06319.05
5.4.270.0030.06319.12
5.4.260.0100.06319.18
5.4.250.0000.05719.04
5.4.240.0030.07319.20
5.4.230.0070.07319.08
5.4.220.0000.07719.23
5.4.210.0000.05718.90
5.4.200.0000.06318.89
5.4.190.0070.04719.04
5.4.180.0030.06318.86
5.4.170.0000.08319.22
5.4.160.0030.07719.21
5.4.150.0030.06319.19
5.4.140.0000.08316.41
5.4.130.0030.06316.41
5.4.120.0030.06016.33
5.4.110.0030.06016.59
5.4.100.0070.07316.56
5.4.90.0030.07316.51
5.4.80.0030.06716.47
5.4.70.0000.06716.55
5.4.60.0000.06316.49
5.4.50.0000.06316.30
5.4.40.0000.07716.30
5.4.30.0030.05716.47
5.4.20.0100.06316.47
5.4.10.0000.06016.39
5.4.00.0000.05315.84
5.3.290.0000.08014.73
5.3.280.0030.04014.66
5.3.270.0170.06014.69
5.3.260.0070.07014.55
5.3.250.0030.06314.74
5.3.240.0070.05714.65
5.3.230.0030.07314.72
5.3.220.0030.07714.65
5.3.210.0070.07014.70
5.3.200.0070.07714.65
5.3.190.0070.06714.60
5.3.180.0030.07314.64
5.3.170.0030.07714.61
5.3.160.0000.07014.64
5.3.150.0000.07314.69
5.3.140.0030.08014.55
5.3.130.0100.07314.69
5.3.120.0000.05014.55
5.3.110.0030.07714.63
5.3.100.0100.05714.11
5.3.90.0000.04014.10
5.3.80.0000.06014.03
5.3.70.0000.08014.03
5.3.60.0000.07014.03
5.3.50.0070.05314.02
5.3.40.0000.04713.89
5.3.30.0030.04714.07
5.3.20.0000.03713.64
5.3.10.0030.03313.68
5.3.00.0000.04013.72
5.2.170.0030.06311.29
5.2.160.0070.05711.19
5.2.150.0030.02711.26
5.2.140.0030.03011.05
5.2.130.0000.04711.21
5.2.120.0000.04011.13
5.2.110.0000.03711.00
5.2.100.0000.03011.13
5.2.90.0000.03011.15
5.2.80.0000.03311.18
5.2.70.0000.03011.23
5.2.60.0000.03311.20
5.2.50.0030.02710.96
5.2.40.0000.03011.08
5.2.30.0000.03011.05
5.2.20.0000.03011.12
5.2.10.0030.02710.93
5.2.00.0000.03010.67
5.1.60.0000.02310.27
5.1.50.0000.02010.27
5.1.40.0000.02310.27
5.1.30.0030.02310.29
5.1.20.0000.02310.29
5.1.10.0030.02310.27
5.1.00.0000.02010.27
5.0.50.0030.01710.27
5.0.40.0000.01710.27
5.0.30.0030.03010.27
5.0.20.0000.02310.27
5.0.10.0000.04010.27
5.0.00.0030.04010.27
4.4.90.0000.01710.27
4.4.80.0000.01710.27
4.4.70.0000.01710.27
4.4.60.0030.01310.27
4.4.50.0030.01310.27
4.4.40.0000.02310.27
4.4.30.0030.01310.27
4.4.20.0030.01310.27
4.4.10.0000.01710.27
4.4.00.0000.02310.27
4.3.110.0000.01310.27
4.3.100.0000.02310.27
4.3.90.0000.02010.27
4.3.80.0030.02710.27
4.3.70.0000.02010.27
4.3.60.0000.02010.27
4.3.50.0030.01310.27
4.3.40.0000.02310.27
4.3.30.0030.03010.27
4.3.20.0070.03310.27
4.3.10.0070.02310.27
4.3.00.0070.02010.27

preferences:
44.61 ms | 401 KiB | 5 Q