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', $str)); $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_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.0140.00716.50
8.3.50.0100.00622.06
8.3.40.0070.01118.67
8.3.30.0070.01018.86
8.3.20.0080.00020.20
8.3.10.0040.00423.65
8.3.00.0080.00021.00
8.2.180.0120.00316.63
8.2.170.0040.01422.96
8.2.160.0130.00320.30
8.2.150.0040.00424.18
8.2.140.0000.00924.66
8.2.130.0040.00426.16
8.2.120.0040.00419.13
8.2.110.0030.00721.07
8.2.100.0060.00618.16
8.2.90.0000.00819.22
8.2.80.0060.00317.97
8.2.70.0030.00617.63
8.2.60.0040.00417.80
8.2.50.0030.00718.07
8.2.40.0000.00718.30
8.2.30.0000.01018.06
8.2.20.0050.00317.64
8.2.10.0000.00817.64
8.2.00.0080.00017.64
8.1.280.0090.00625.92
8.1.270.0040.00423.84
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00321.23
8.1.230.0080.00317.76
8.1.220.0080.00017.74
8.1.210.0080.00018.77
8.1.200.0100.00017.35
8.1.190.0030.00617.52
8.1.180.0030.00518.10
8.1.170.0050.00318.70
8.1.160.0070.00021.96
8.1.150.0040.00418.64
8.1.140.0070.00017.35
8.1.130.0040.00417.53
8.1.120.0040.00417.51
8.1.110.0070.00017.36
8.1.100.0040.00417.34
8.1.90.0000.00717.49
8.1.80.0000.00717.46
8.1.70.0020.00517.46
8.1.60.0000.00917.54
8.1.50.0080.00017.61
8.1.40.0030.00617.60
8.1.30.0040.00417.59
8.1.20.0080.00017.66
8.1.10.0040.00417.58
8.1.00.0110.00017.51
8.0.300.0080.00018.77
8.0.290.0000.00717.29
8.0.280.0030.00318.39
8.0.270.0070.00017.18
8.0.260.0030.00316.85
8.0.250.0070.00017.02
8.0.240.0050.00216.89
8.0.230.0030.00317.00
8.0.220.0070.00016.92
8.0.210.0030.00516.85
8.0.200.0000.00717.00
8.0.190.0070.00016.93
8.0.180.0070.00016.92
8.0.170.0040.00416.95
8.0.160.0040.00416.79
8.0.150.0000.00716.79
8.0.140.0040.00416.79
8.0.130.0060.00013.35
8.0.120.0040.00416.93
8.0.110.0040.00416.95
8.0.100.0080.00016.96
8.0.90.0040.00416.82
8.0.80.0090.00616.93
8.0.70.0070.00016.84
8.0.60.0030.00616.80
8.0.50.0030.00616.88
8.0.30.0120.00617.02
8.0.20.0130.00617.40
8.0.10.0040.00416.95
8.0.00.0090.00916.74
7.4.330.0030.00315.15
7.4.320.0040.00416.55
7.4.300.0030.00316.61
7.4.290.0070.00016.63
7.4.280.0000.00816.51
7.4.270.0050.00316.60
7.4.260.0000.00816.42
7.4.250.0040.00416.51
7.4.240.0030.00316.54
7.4.230.0030.00316.65
7.4.220.0070.01316.66
7.4.210.0100.00716.68
7.4.200.0050.00216.63
7.4.190.0030.00316.73
7.4.160.0130.00316.59
7.4.150.0070.01117.40
7.4.140.0160.00517.86
7.4.130.0060.01116.44
7.4.120.0090.00816.58
7.4.110.0050.01216.65
7.4.100.0160.00616.56
7.4.90.0100.00716.46
7.4.80.0160.00719.39
7.4.70.0070.01416.45
7.4.60.0110.00716.57
7.4.50.0000.00516.50
7.4.40.0050.01022.77
7.4.30.0040.01316.60
7.4.00.0030.01415.01
7.3.330.0030.00313.16
7.3.320.0020.00213.37
7.3.310.0000.00716.47
7.3.300.0030.00316.38
7.3.290.0110.00416.36
7.3.280.0060.01116.35
7.3.270.0070.01517.40
7.3.260.0110.00716.37
7.3.250.0130.00916.41
7.3.240.0140.00316.59
7.3.230.0090.00616.39
7.3.210.0100.00616.32
7.3.200.0100.01019.39
7.3.190.0070.01616.66
7.3.180.0110.00416.57
7.3.170.0090.01316.40
7.3.160.0100.00716.39
7.3.120.0020.01414.95
7.3.110.0080.00914.91
7.3.100.0070.00914.86
7.3.90.0060.00614.81
7.3.80.0050.01014.95
7.3.70.0090.00714.72
7.3.60.0050.00514.92
7.3.50.0070.00714.78
7.3.40.0040.01114.81
7.3.30.0020.01214.74
7.3.20.0030.01016.69
7.3.10.0070.00316.78
7.3.00.0090.00516.84
7.2.330.0160.00316.55
7.2.320.0060.01216.78
7.2.310.0140.00316.68
7.2.300.0050.01116.52
7.2.290.0040.01216.65
7.2.250.0090.00915.04
7.2.240.0080.01214.94
7.2.230.0060.00915.13
7.2.220.0030.01015.07
7.2.210.0070.00614.84
7.2.200.0090.00715.04
7.2.190.0030.01014.96
7.2.180.0050.01014.97
7.2.170.0100.00514.99
7.2.160.0070.00314.99
7.2.150.0040.00816.65
7.2.140.0040.01117.08
7.2.130.0100.00717.07
7.2.120.0060.01017.02
7.2.110.0000.01416.85
7.2.100.0110.00017.02
7.2.90.0030.01016.98
7.2.80.0060.01017.04
7.2.70.0100.00716.96
7.2.60.0130.00516.92
7.2.50.0070.01016.90
7.2.40.0090.00617.05
7.2.30.0090.00316.98
7.2.20.0050.00516.87
7.2.10.0060.00616.99
7.2.00.0060.00616.96
7.1.330.0050.01215.82
7.1.320.0070.00515.78
7.1.310.0050.01015.92
7.1.300.0050.00815.78
7.1.290.0030.00915.83
7.1.280.0070.00615.77
7.1.270.0020.01215.76
7.1.260.0090.00615.76
7.1.250.0000.00915.98
7.1.200.0030.00915.97
7.1.100.0060.00618.35
7.1.70.0080.00617.12
7.1.60.0100.01619.29
7.1.50.0070.01716.86
7.1.00.0100.07022.44
7.0.200.0060.00316.65
7.0.140.0030.07322.04
7.0.100.0400.06019.97
7.0.90.0000.08720.04
7.0.80.0230.04719.86
7.0.70.0200.05020.01
7.0.60.0070.05019.94
7.0.50.0070.07320.31
7.0.40.0170.08020.11
7.0.30.0070.08320.11
7.0.20.0100.04020.06
7.0.10.0170.05719.95
7.0.00.0130.06720.10
5.6.280.0070.07321.13
5.6.250.0100.04020.54
5.6.240.0030.08720.58
5.6.230.0100.07320.70
5.6.220.0100.08020.54
5.6.210.0100.07020.48
5.6.200.0030.05021.04
5.6.190.0130.04321.09
5.6.180.0100.05720.95
5.6.170.0070.07321.19
5.6.160.0070.08321.09
5.6.150.0030.08321.12
5.6.140.0070.05320.95
5.6.130.0030.05321.09
5.6.120.0070.08321.09
5.6.110.0100.08021.02
5.6.100.0030.09320.94
5.6.90.0070.08720.99
5.6.80.0130.07020.40
5.6.70.0100.05720.41
5.6.60.0070.07720.50
5.6.50.0170.07020.45
5.6.40.0030.08720.39
5.6.30.0070.08720.31
5.6.20.0100.07720.43
5.6.10.0030.08320.41
5.6.00.0100.07720.44
5.5.380.0100.05720.45
5.5.370.0030.08020.39
5.5.360.0070.08020.35
5.5.350.0100.04020.47
5.5.340.0100.07720.94
5.5.330.0070.08720.95
5.5.320.0070.07320.82
5.5.310.0070.08020.81
5.5.300.0100.08020.94
5.5.290.0070.04720.92
5.5.280.0000.05720.76
5.5.270.0130.07720.77
5.5.260.0100.06720.92
5.5.250.0100.08320.44
5.5.240.0070.04720.29
5.5.230.0070.05020.23
5.5.220.0000.08320.23
5.5.210.0070.08020.30
5.5.200.0000.05720.13
5.5.190.0130.06020.30
5.5.180.0030.07320.25
5.5.160.0100.07020.26
5.5.150.0070.08020.29
5.5.140.0100.07320.23
5.5.130.0000.08020.26
5.5.120.0130.07020.16
5.5.110.0070.07020.25
5.5.100.0070.07720.13
5.5.90.0030.04720.11
5.5.80.0200.06720.19
5.5.70.0100.05720.05
5.5.60.0070.07320.04
5.5.50.0170.06320.03
5.5.40.0070.08019.93
5.5.30.0070.07020.11
5.5.20.0070.04320.07
5.5.10.0100.04320.03
5.5.00.0070.08020.09
5.4.450.0030.06319.50
5.4.440.0100.04019.23
5.4.430.0170.04319.37
5.4.420.0070.07719.32
5.4.410.0100.07719.08
5.4.400.0100.06018.91
5.4.390.0070.05719.05
5.4.380.0070.07719.11
5.4.370.0070.07319.04
5.4.360.0170.06719.21
5.4.350.0070.07319.17
5.4.340.0000.05019.16
5.4.320.0070.07718.93
5.4.310.0100.07319.01
5.4.300.0130.07019.03
5.4.290.0070.04318.88
5.4.280.0100.08019.23
5.4.270.0030.08019.18
5.4.260.0030.05719.03
5.4.250.0070.07019.24
5.4.240.0030.07719.11
5.4.230.0130.04019.02
5.4.220.0070.04018.94
5.4.210.0070.07019.04
5.4.200.0030.07318.89
5.4.190.0030.07719.23
5.4.180.0130.07319.02
5.4.170.0070.06019.22
5.4.160.0070.04719.16
5.4.150.0070.06019.10
5.4.140.0100.06716.24
5.4.130.0130.04016.50
5.4.120.0030.05716.50
5.4.110.0030.04016.48
5.4.100.0030.07316.40
5.4.90.0070.04316.55
5.4.80.0070.06716.54
5.4.70.0100.07316.51
5.4.60.0000.07316.42
5.4.50.0000.05016.46
5.4.40.0070.07316.39
5.4.30.0070.06716.40
5.4.20.0030.07716.30
5.4.10.0130.06316.48
5.4.00.0100.06015.91
5.3.290.0070.07714.66
5.3.280.0000.08014.72
5.3.270.0030.04714.68
5.3.260.0100.07014.58
5.3.250.0130.07014.72
5.3.240.0070.04314.60
5.3.230.0100.07314.75
5.3.220.0030.08314.64
5.3.210.0030.08014.53
5.3.200.0100.07014.73
5.3.190.0070.07714.71
5.3.180.0070.07314.65
5.3.170.0000.08014.65
5.3.160.0170.04714.57
5.3.150.0100.06314.54
5.3.140.0100.07314.64
5.3.130.0070.04314.55
5.3.120.0070.04714.55
5.3.110.0070.07314.57
5.3.100.0030.07314.07
5.3.90.0100.07014.06
5.3.80.0070.05014.07
5.3.70.0000.06714.13
5.3.60.0100.07014.01
5.3.50.0100.06713.88
5.3.40.0100.06714.11
5.3.30.0200.05713.96
5.3.20.0000.07713.77
5.3.10.0030.05713.73
5.3.00.0030.07013.71
5.2.170.0000.03711.04
5.2.160.0100.05311.03
5.2.150.0030.06311.10
5.2.140.0070.05311.07
5.2.130.0070.06011.18
5.2.120.0070.04711.11
5.2.110.0100.05711.19
5.2.100.0070.06011.18
5.2.90.0070.04711.22
5.2.80.0000.06311.13
5.2.70.0070.03011.17
5.2.60.0030.06310.94
5.2.50.0030.03711.11
5.2.40.0200.04711.01
5.2.30.0030.06711.12
5.2.20.0030.05311.00
5.2.10.0130.05010.83
5.2.00.0070.06010.83
5.1.60.0070.0509.87
5.1.50.0000.03010.05
5.1.40.0070.0309.88
5.1.30.0070.05310.48
5.1.20.0070.03010.29
5.1.10.0000.05010.18
5.1.00.0100.03010.10
5.0.50.0030.0378.57
5.0.40.0030.0438.48
5.0.30.0030.0578.48
5.0.20.0000.0308.48
5.0.10.0100.0338.48
5.0.00.0030.0638.48
4.4.90.0000.0408.48
4.4.80.0030.0378.48
4.4.70.0000.0378.48
4.4.60.0030.0278.48
4.4.50.0030.0278.48
4.4.40.0000.0608.48
4.4.30.0030.0338.48
4.4.20.0030.0338.48
4.4.10.0030.0338.48
4.4.00.0030.0378.48
4.3.110.0000.0278.48
4.3.100.0000.0308.48
4.3.90.0070.0278.48
4.3.80.0030.0508.48
4.3.70.0000.0208.48
4.3.60.0030.0338.48
4.3.50.0000.0338.48
4.3.40.0100.0438.48
4.3.30.0030.0308.48
4.3.20.0070.0338.48
4.3.10.0000.0338.48
4.3.00.0000.0378.48

preferences:
35.19 ms | 401 KiB | 5 Q