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('N*', $str)); var_dump($longs); $signBit = (bool) ($longs[0] & 0x80000000); $isSigned = (bool) ($flags & INT_SIGNED); if (is32Bit()) { $longs[1] = (($longs[1] & 0x7FFFFFFF) * 2) + ~$longs[1] + 1; $result = ($longs[0] * pow(2, 32)) + $longs[1]; } else { $result = ($longs[0] << 32) | $longs[1]; if ($signBit && !$isSigned) { $result = (($result & 0x7FFFFFFFFFFFFFFe) * 2) + ~$result + 1; } } return $result; } printf('%f', unpack_int64("\x80\x00\x00\x07\xFF\xFF\xFF\xFF"));

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.0090.01216.73
8.3.50.0160.00721.98
8.3.40.0150.00318.75
8.3.30.0100.00319.06
8.3.20.0030.00519.99
8.3.10.0060.00323.71
8.3.00.0080.00022.38
8.2.180.0060.00918.41
8.2.170.0070.01022.96
8.2.160.0100.00322.26
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0080.00022.26
8.2.110.0080.00322.25
8.2.100.0040.00717.91
8.2.90.0050.00317.84
8.2.80.0060.00319.05
8.2.70.0000.01018.05
8.2.60.0050.00318.05
8.2.50.0050.00318.10
8.2.40.0090.00020.42
8.2.30.0040.00418.05
8.2.20.0040.00417.74
8.2.10.0000.00817.75
8.2.00.0040.00417.64
8.1.280.0100.00725.92
8.1.270.0030.00623.95
8.1.260.0030.00626.35
8.1.250.0000.00928.09
8.1.240.0040.00422.14
8.1.230.0080.00421.03
8.1.220.0030.00617.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0050.00317.23
8.1.180.0030.00518.10
8.1.170.0080.00018.62
8.1.160.0050.00222.13
8.1.150.0040.00418.53
8.1.140.0000.00717.35
8.1.130.0030.00317.84
8.1.120.0000.00717.51
8.1.110.0000.00817.46
8.1.100.0040.00417.37
8.1.90.0040.00717.52
8.1.80.0000.00717.36
8.1.70.0030.00317.44
8.1.60.0030.00617.48
8.1.50.0080.00017.43
8.1.40.0000.00817.43
8.1.30.0000.00917.60
8.1.20.0080.00017.64
8.1.10.0040.00417.47
8.1.00.0080.00017.44
8.0.300.0040.00420.09
8.0.290.0000.00716.75
8.0.280.0030.00318.57
8.0.270.0070.00017.20
8.0.260.0000.00716.89
8.0.250.0070.00017.04
8.0.240.0000.00716.99
8.0.230.0050.00216.94
8.0.220.0030.00316.98
8.0.210.0030.00316.92
8.0.200.0000.00616.84
8.0.190.0020.00516.84
8.0.180.0040.00416.97
8.0.170.0060.00316.88
8.0.160.0050.00316.88
8.0.150.0000.00716.81
8.0.140.0040.00416.77
8.0.130.0000.00613.38
8.0.120.0050.00516.88
8.0.110.0000.00716.89
8.0.100.0040.00416.93
8.0.90.0040.00416.89
8.0.80.0070.00716.88
8.0.70.0040.00416.79
8.0.60.0050.00216.94
8.0.50.0000.00716.73
8.0.30.0080.01117.07
8.0.20.0120.00717.40
8.0.10.0000.00717.05
8.0.00.0120.00716.89
7.4.330.0000.00515.14
7.4.320.0000.00716.51
7.4.300.0030.00316.46
7.4.290.0070.00316.49
7.4.280.0000.00716.55
7.4.270.0050.00516.59
7.4.260.0030.00316.60
7.4.250.0050.00316.50
7.4.240.0020.00616.61
7.4.230.0000.00716.57
7.4.220.0140.00316.64
7.4.210.0100.00416.62
7.4.200.0000.00716.70
7.4.190.0000.00716.33
7.4.160.0130.00316.48
7.4.150.0070.01717.40
7.4.140.0140.00817.86
7.4.130.0100.00916.56
7.4.120.0150.00216.56
7.4.110.0130.00416.44
7.4.100.0150.00616.59
7.4.90.0090.01216.59
7.4.80.0130.00719.39
7.4.70.0070.01016.54
7.4.60.0160.00316.41
7.4.50.0000.00816.53
7.4.40.0030.01322.77
7.4.30.0000.01616.51
7.4.00.0070.01014.85
7.3.330.0060.00013.46
7.3.320.0000.00613.19
7.3.310.0030.00316.23
7.3.300.0040.00416.26
7.3.290.0130.00616.40
7.3.280.0070.00816.36
7.3.270.0130.00417.40
7.3.260.0120.00616.37
7.3.250.0050.01216.58
7.3.240.0150.00616.64
7.3.230.0030.01216.46
7.3.210.0070.01016.39
7.3.200.0140.00319.39
7.3.190.0100.01316.48
7.3.180.0100.00616.48
7.3.170.0040.01116.45
7.3.160.0060.01616.64
7.3.120.0050.01114.93
7.3.110.0190.00014.91
7.3.100.0000.01114.89
7.3.90.0080.00315.07
7.3.80.0000.01114.79
7.3.70.0040.01214.91
7.3.60.0030.00914.83
7.3.50.0000.01114.82
7.3.40.0080.00814.98
7.3.30.0000.01514.51
7.3.20.0040.00816.81
7.3.10.0040.01216.82
7.3.00.0030.01116.55
7.2.330.0100.01016.93
7.2.320.0150.00916.76
7.2.310.0030.01316.80
7.2.300.0120.00616.85
7.2.290.0150.00916.56
7.2.250.0100.00715.22
7.2.240.0130.00714.76
7.2.230.0040.00814.94
7.2.220.0040.01115.20
7.2.210.0130.00315.21
7.2.200.0050.00515.07
7.2.190.0030.01015.04
7.2.180.0060.00915.26
7.2.170.0040.01114.83
7.2.130.0040.00916.84
7.2.120.0060.00816.78
7.2.110.0040.00616.84
7.2.100.0100.00416.82
7.2.90.0100.00516.79
7.2.80.0100.00616.96
7.2.70.0070.00916.67
7.2.60.0030.01016.71
7.2.50.0050.00817.03
7.2.40.0090.00816.98
7.2.30.0030.01016.65
7.2.20.0030.01116.87
7.2.10.0070.00616.87
7.2.00.0050.00516.64
7.1.330.0090.00315.75
7.1.320.0040.00415.68
7.1.310.0030.01015.54
7.1.300.0030.00715.80
7.1.290.0000.01215.89
7.1.280.0030.01015.51
7.1.270.0060.00615.77
7.1.260.0040.00815.89
7.1.250.0050.00715.83
7.1.200.0100.00315.93
7.1.100.0070.00718.02
7.1.70.0000.01017.04
7.1.60.0090.01519.29
7.1.50.0210.01216.88
7.1.00.0100.06322.28
7.0.200.0060.00616.73
7.0.140.0000.07721.97
7.0.70.0070.08321.68
7.0.60.0000.05721.86
7.0.50.0030.06721.93
7.0.40.0000.08720.09
7.0.30.0030.09020.07
7.0.20.0030.08720.08
7.0.10.0100.07720.12
7.0.00.0070.08720.09
5.6.280.0070.07020.91
5.6.220.0100.06720.58
5.6.210.0130.08320.48
5.6.200.0100.07021.09
5.6.190.0100.08021.09
5.6.180.0070.06321.05
5.6.170.0070.06021.02
5.6.160.0070.05321.16
5.6.150.0100.07321.06
5.6.140.0030.08721.13
5.6.130.0200.05321.01
5.6.120.0070.06321.04
5.6.110.0100.05021.06
5.6.100.0070.06021.03
5.6.90.0000.09321.02
5.6.80.0100.06320.35
5.6.70.0000.08320.50
5.6.60.0030.08020.41
5.6.50.0070.07720.54
5.6.40.0070.06020.31
5.6.30.0030.07720.51
5.6.20.0070.06320.45
5.6.10.0030.07320.31
5.6.00.0130.07020.38
5.5.360.0070.08720.55
5.5.350.0030.04720.41
5.5.340.0130.04720.95
5.5.330.0030.06020.86
5.5.320.0070.08320.64
5.5.310.0070.04720.91
5.5.300.0030.08720.66
5.5.290.0030.07320.81
5.5.280.0030.07320.75
5.5.270.0030.08720.81
5.5.260.0000.09320.78
5.5.250.0070.07720.68
5.5.240.0070.08020.27
5.5.230.0030.08320.32
5.5.220.0030.08320.27
5.5.210.0100.07320.26
5.5.200.0000.07720.25
5.5.190.0030.08320.13
5.5.180.0000.08320.29
5.5.160.0030.08320.21
5.5.150.0000.08320.27
5.5.140.0070.08020.16
5.5.130.0000.08320.25
5.5.120.0030.07720.20
5.5.110.0000.06720.29
5.5.100.0070.06020.13
5.5.90.0100.06320.11
5.5.80.0030.07320.09
5.5.70.0030.06019.97
5.5.60.0000.08320.07
5.5.50.0030.07720.10
5.5.40.0070.06320.08
5.5.30.0100.05020.06
5.5.20.0000.08320.10
5.5.10.0070.08019.98
5.5.00.0070.06720.06
5.4.450.0030.07719.45
5.4.440.0070.06319.54
5.4.430.0070.08319.44
5.4.420.0030.07319.55
5.4.410.0070.07719.27
5.4.400.0030.07719.14
5.4.390.0070.07019.09
5.4.380.0000.08019.04
5.4.370.0000.08019.18
5.4.360.0070.07719.18
5.4.350.0030.06018.84
5.4.340.0000.07718.90
5.4.320.0070.07018.95
5.4.310.0070.05318.85
5.4.300.0070.05019.03
5.4.290.0070.07318.94
5.4.280.0070.07319.04
5.4.270.0100.06718.87
5.4.260.0070.07319.04
5.4.250.0000.08019.10
5.4.240.0000.08318.86
5.4.230.0030.08019.13
5.4.220.0030.07719.24
5.4.210.0070.07019.04
5.4.200.0030.07718.94
5.4.190.0070.05019.11
5.4.180.0030.05718.87
5.4.170.0030.04719.13
5.4.160.0000.04319.12
5.4.150.0030.08019.19
5.4.140.0030.07316.51
5.4.130.0000.06716.46
5.4.120.0070.07316.38
5.4.110.0100.07316.44
5.4.100.0030.04716.56
5.4.90.0000.08016.45
5.4.80.0070.04016.50
5.4.70.0030.05016.43
5.4.60.0000.05716.48
5.4.50.0030.07016.38
5.4.40.0070.07316.50
5.4.30.0070.07316.45
5.4.20.0100.06016.46
5.4.10.0070.06316.47
5.4.00.0070.06715.86
5.3.290.0000.06014.65
5.3.280.0030.07314.67
5.3.270.0030.05714.79
5.3.260.0030.07714.68
5.3.250.0070.07714.55
5.3.240.0000.07714.75
5.3.230.0070.07314.59
5.3.220.0030.07014.62
5.3.210.0030.06714.61
5.3.200.0000.08314.65
5.3.190.0070.04014.73
5.3.180.0030.04714.61
5.3.170.0000.08014.73
5.3.160.0000.04014.52
5.3.150.0030.07014.64
5.3.140.0130.06314.59
5.3.130.0100.06314.55
5.3.120.0100.07014.63
5.3.110.0100.07314.63
5.3.100.0000.07014.02
5.3.90.0000.05014.02
5.3.80.0030.07714.02
5.3.70.0070.07314.18
5.3.60.0030.07014.13
5.3.50.0030.07014.02
5.3.40.0070.05313.98
5.3.30.0030.07714.02
5.3.20.0070.07013.72
5.3.10.0070.06713.68
5.3.00.0030.07713.57
5.2.170.0000.07012.30
5.2.160.0000.06012.30
5.2.150.0000.04312.30
5.2.140.0000.06312.30
5.2.130.0070.06012.30
5.2.120.0030.04012.30
5.2.110.0030.05712.30
5.2.100.0070.05712.30
5.2.90.0070.04712.30
5.2.80.0000.06312.30
5.2.70.0000.06312.30
5.2.60.0000.06712.30
5.2.50.0000.06712.30
5.2.40.0000.05712.30
5.2.30.0030.06712.30
5.2.20.0100.05712.30
5.2.10.0030.06012.30
5.2.00.0000.05712.30
5.1.60.0030.05312.30
5.1.50.0030.04712.30
5.1.40.0070.05012.30
5.1.30.0070.05312.30
5.1.20.0030.05712.30
5.1.10.0030.05312.30
5.1.00.0000.06012.30
5.0.50.0000.05012.30
5.0.40.0030.04712.30
5.0.30.0000.06312.30
5.0.20.0030.04312.30
5.0.10.0000.04312.30
5.0.00.0000.06712.30
4.4.90.0030.03012.30
4.4.80.0100.02712.30
4.4.70.0030.03712.30
4.4.60.0000.03012.30
4.4.50.0000.03312.30
4.4.40.0000.05312.30
4.4.30.0030.02312.30
4.4.20.0030.03712.30
4.4.10.0030.03712.30
4.4.00.0030.05312.30
4.3.110.0000.04012.30
4.3.100.0070.03012.30
4.3.90.0030.02712.30
4.3.80.0000.05712.30
4.3.70.0000.03312.30
4.3.60.0000.03312.30
4.3.50.0000.04012.30
4.3.40.0070.04712.30
4.3.30.0030.03712.30
4.3.20.0000.03712.30
4.3.10.0000.04012.30
4.3.00.0070.03012.30

preferences:
70.66 ms | 401 KiB | 5 Q