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); } $is32bit = is32Bit(); 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.0040.01118.65
8.3.50.0080.00921.98
8.3.40.0120.00318.54
8.3.30.0090.00618.67
8.3.20.0040.00418.73
8.3.10.0080.00021.23
8.3.00.0060.00322.03
8.2.180.0180.00016.75
8.2.170.0090.00622.96
8.2.160.0090.00620.53
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00021.04
8.2.110.0030.00720.50
8.2.100.0090.00317.84
8.2.90.0000.00819.28
8.2.80.0040.00417.97
8.2.70.0030.00517.50
8.2.60.0040.00418.05
8.2.50.0060.00318.07
8.2.40.0060.00318.22
8.2.30.0070.00021.39
8.2.20.0000.00817.74
8.2.10.0030.00617.72
8.2.00.0080.00417.77
8.1.280.0070.01125.92
8.1.270.0000.00823.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0040.00722.41
8.1.230.0100.00320.97
8.1.220.0000.00818.77
8.1.210.0060.00319.04
8.1.200.0060.00317.38
8.1.190.0080.00017.53
8.1.180.0030.00618.10
8.1.170.0070.00318.78
8.1.160.0000.00718.98
8.1.150.0030.00618.72
8.1.140.0080.00017.57
8.1.130.0030.00317.96
8.1.120.0000.00717.54
8.1.110.0000.00817.61
8.1.100.0000.00817.45
8.1.90.0000.00717.54
8.1.80.0040.00417.52
8.1.70.0030.00317.54
8.1.60.0050.00517.73
8.1.50.0030.00617.63
8.1.40.0000.00717.59
8.1.30.0040.00417.71
8.1.20.0000.00917.73
8.1.10.0040.00417.61
8.1.00.0070.00317.45
8.0.300.0040.00420.15
8.0.290.0040.00417.16
8.0.280.0070.00018.51
8.0.270.0030.00317.23
8.0.260.0030.00316.92
8.0.250.0030.00616.96
8.0.240.0040.00416.99
8.0.230.0000.00717.07
8.0.220.0070.00016.88
8.0.210.0080.00016.99
8.0.200.0000.00617.04
8.0.190.0000.00716.96
8.0.180.0000.00716.91
8.0.170.0000.00716.95
8.0.160.0040.00317.00
8.0.150.0040.00416.79
8.0.140.0000.00716.97
8.0.130.0060.00013.40
8.0.120.0090.00016.96
8.0.110.0040.00417.03
8.0.100.0000.00816.82
8.0.90.0000.00817.03
8.0.80.0110.00617.05
8.0.70.0050.00216.85
8.0.60.0070.00016.98
8.0.50.0030.00516.98
8.0.30.0170.00817.29
8.0.20.0090.00917.43
8.0.10.0030.00517.01
8.0.00.0130.00517.02
7.4.330.0000.00516.77
7.4.320.0000.00716.60
7.4.300.0030.00316.59
7.4.290.0000.00716.61
7.4.280.0000.00916.49
7.4.270.0030.00316.72
7.4.260.0000.00513.32
7.4.250.0080.00016.61
7.4.240.0050.00316.65
7.4.230.0040.00416.73
7.4.220.0090.01616.52
7.4.210.0080.00816.63
7.4.200.0000.00716.72
7.4.190.0050.00316.74
7.4.160.0000.01616.57
7.4.150.0070.01017.40
7.4.140.0140.00617.86
7.4.130.0080.01116.46
7.4.120.0070.01316.70
7.4.110.0090.00916.70
7.4.100.0090.00816.61
7.4.90.0100.00716.66
7.4.80.0100.00719.39
7.4.70.0120.00416.57
7.4.60.0080.00816.59
7.4.50.0030.00616.65
7.4.40.0170.00322.77
7.4.30.0080.00816.70
7.4.00.0150.00014.95
7.3.330.0050.00013.42
7.3.320.0120.00013.40
7.3.310.0000.00716.44
7.3.300.0070.00016.48
7.3.290.0110.00316.46
7.3.280.0100.00916.41
7.3.270.0060.01217.40
7.3.260.0140.01118.24
7.3.250.0110.00716.50
7.3.240.0100.00716.47
7.3.230.0130.00316.43
7.3.210.0070.01016.56
7.3.200.0090.00919.39
7.3.190.0070.01016.51
7.3.180.0060.01016.26
7.3.170.0100.00716.34
7.3.160.0110.00616.70
7.3.120.0060.00914.64
7.3.10.0060.00916.64
7.3.00.0090.00416.63
7.2.330.0130.00716.56
7.2.320.0110.00716.72
7.2.310.0100.01316.87
7.2.300.0030.01316.77
7.2.290.0030.01316.80
7.2.130.0070.00516.83
7.2.120.0040.01016.71
7.2.110.0070.00516.79
7.2.100.0020.01116.93
7.2.90.0070.00816.93
7.2.80.0080.00716.94
7.2.70.0080.00816.78
7.2.60.0040.01117.00
7.2.50.0060.00416.98
7.2.40.0050.00816.83
7.2.30.0090.00516.97
7.2.20.0080.00916.84
7.2.10.0080.00516.91
7.2.00.0090.00616.97
7.1.250.0070.00815.92
7.1.100.0030.00918.12
7.1.70.0000.01017.10
7.1.60.0100.01319.40
7.1.50.0030.01917.09
7.1.00.0000.04022.46
7.0.200.0210.00416.38
7.0.140.0030.07021.95
7.0.70.0070.07721.86
7.0.60.0000.08021.82
7.0.50.0000.08322.31
7.0.40.0100.07720.24
7.0.30.0070.08720.29
7.0.20.0070.08320.19
7.0.10.0070.06320.08
7.0.00.0000.09320.16
5.6.280.0170.06021.12
5.6.220.0030.05720.57
5.6.210.0070.08020.73
5.6.200.0000.06721.23
5.6.190.0100.05321.22
5.6.180.0070.08721.12
5.6.170.0000.08021.13
5.6.160.0070.04721.12
5.6.150.0030.04721.27
5.6.140.0130.07721.10
5.6.130.0000.09021.21
5.6.120.0030.08721.14
5.6.110.0030.08321.04
5.6.100.0000.09021.21
5.6.90.0030.05321.25
5.6.80.0030.07720.53
5.6.70.0130.07720.60
5.6.60.0000.08720.50
5.6.50.0030.07720.60
5.6.40.0070.07020.48
5.6.30.0070.07720.48
5.6.20.0030.08020.38
5.6.10.0030.07720.41
5.6.00.0000.07020.55
5.5.360.0030.05720.66
5.5.350.0030.05020.48
5.5.340.0000.07320.98
5.5.330.0030.05720.95
5.5.320.0030.08320.95
5.5.310.0030.08720.98
5.5.300.0070.04320.99
5.5.290.0000.06720.97
5.5.280.0030.05721.02
5.5.270.0070.08020.80
5.5.260.0030.05020.86
5.5.250.0070.08320.65
5.5.240.0070.07720.29
5.5.230.0070.06720.45
5.5.220.0000.08020.34
5.5.210.0030.08320.36
5.5.200.0000.07020.40
5.5.190.0030.08320.32
5.5.180.0030.08320.45
5.5.160.0030.08320.45
5.5.150.0000.06020.28
5.5.140.0000.04720.31
5.5.130.0070.04020.30
5.5.120.0100.05720.31
5.5.110.0000.04020.40
5.5.100.0030.08720.11
5.5.90.0100.05320.29
5.5.80.0070.07020.30
5.5.70.0000.04720.24
5.5.60.0030.08020.21
5.5.50.0070.07720.16
5.5.40.0030.05020.07
5.5.30.0100.07720.08
5.5.20.0000.04720.17
5.5.10.0130.03020.15
5.5.00.0070.04020.18
5.4.450.0000.06019.37
5.4.440.0000.08019.46
5.4.430.0070.08719.50
5.4.420.0030.06319.35
5.4.410.0000.08719.32
5.4.400.0000.08019.05
5.4.390.0030.08018.90
5.4.380.0000.08319.21
5.4.370.0000.07719.03
5.4.360.0000.08319.09
5.4.350.0070.07318.88
5.4.340.0000.08318.88
5.4.320.0070.07719.13
5.4.310.0070.07318.89
5.4.300.0070.07319.04
5.4.290.0000.07319.06
5.4.280.0070.05719.14
5.4.270.0070.07718.87
5.4.260.0030.07718.88
5.4.250.0100.06019.17
5.4.240.0030.05719.22
5.4.230.0030.07719.08
5.4.220.0000.06018.86
5.4.210.0000.07718.87
5.4.200.0000.08719.02
5.4.190.0070.07018.91
5.4.180.0030.06019.09
5.4.170.0030.05318.86
5.4.160.0000.04319.08
5.4.150.0000.04019.14
5.4.140.0030.03716.24
5.4.130.0000.03716.32
5.4.120.0000.03316.25
5.4.110.0030.03316.45
5.4.100.0000.03716.38
5.4.90.0070.03016.52
5.4.80.0030.03316.55
5.4.70.0070.04716.38
5.4.60.0030.03316.40
5.4.50.0000.03716.46
5.4.40.0030.03316.39
5.4.30.0070.03016.37
5.4.20.0030.03316.45
5.4.10.0000.04016.40
5.4.00.0030.04015.89
5.3.290.0030.05714.74
5.3.280.0030.07314.53
5.3.270.0000.04714.63
5.3.260.0000.03714.57
5.3.250.0000.03714.62
5.3.240.0030.03314.54
5.3.230.0000.03714.54
5.3.220.0000.03714.67
5.3.210.0000.03714.71
5.3.200.0100.03014.54
5.3.190.0030.06014.67
5.3.180.0000.03714.59
5.3.170.0030.03714.66
5.3.160.0000.03714.50
5.3.150.0030.03314.58
5.3.140.0000.04014.52
5.3.130.0000.04014.53
5.3.120.0030.03714.63
5.3.110.0030.03714.53
5.3.100.0030.03313.98
5.3.90.0000.03714.01
5.3.80.0000.03714.09
5.3.70.0000.03714.01
5.3.60.0000.03713.94
5.3.50.0000.03314.10
5.3.40.0000.03713.89
5.3.30.0030.03314.04
5.3.20.0030.03313.61
5.3.10.0000.03313.68
5.3.00.0000.03713.67
5.2.170.0030.02712.18
5.2.160.0030.03712.18
5.2.150.0000.03312.18
5.2.140.0000.03012.18
5.2.130.0070.02312.18
5.2.120.0070.02312.18
5.2.110.0000.02312.18
5.2.100.0000.03712.18
5.2.90.0030.02712.18
5.2.80.0000.03012.18
5.2.70.0030.04312.18
5.2.60.0000.03012.18
5.2.50.0030.02712.18
5.2.40.0070.02312.18
5.2.30.0000.02312.18
5.2.20.0030.02012.18
5.2.10.0000.02712.18
5.2.00.0000.02712.18
5.1.60.0000.03312.18
5.1.50.0000.02312.18
5.1.40.0000.02012.18
5.1.30.0030.03012.18
5.1.20.0000.03012.18
5.1.10.0030.02312.18
5.1.00.0000.04312.18
5.0.50.0000.02012.18
5.0.40.0000.02012.18
5.0.30.0000.05312.18
5.0.20.0000.02012.18
5.0.10.0000.01712.18
5.0.00.0030.02712.18
4.4.90.0000.01712.18
4.4.80.0070.02012.18
4.4.70.0000.01312.18
4.4.60.0000.01712.18
4.4.50.0000.01712.18
4.4.40.0030.02312.18
4.4.30.0030.01012.18
4.4.20.0030.01312.18
4.4.10.0000.01312.18
4.4.00.0000.02312.18
4.3.110.0000.01312.18
4.3.100.0030.01712.18
4.3.90.0000.01312.18
4.3.80.0000.02012.18
4.3.70.0000.02012.18
4.3.60.0000.03312.18
4.3.50.0000.02012.18
4.3.40.0000.05012.18
4.3.30.0030.02712.18
4.3.20.0030.02012.18
4.3.10.0000.02712.18
4.3.00.0000.02712.18

preferences:
44.84 ms | 401 KiB | 5 Q