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()) { $result = 0; } else { $result = ($longs[0] << 32) | $longs[1]; if ($signBit && !$isSigned) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } return $result; } var_dump(unpack_int64("\x00\x00\x00\x0F\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.0080.00816.63
8.3.50.0130.00717.22
8.3.40.0110.01118.77
8.3.30.0060.01018.71
8.3.20.0080.00018.56
8.3.10.0050.00318.48
8.3.00.0030.00719.35
8.2.180.0040.01116.74
8.2.170.0040.01422.96
8.2.160.0100.00718.83
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0080.00019.79
8.2.110.0000.00919.45
8.2.100.0030.00917.95
8.2.90.0080.00017.63
8.2.80.0040.00417.97
8.2.70.0030.00917.80
8.2.60.0080.00018.22
8.2.50.0030.00518.10
8.2.40.0040.00419.30
8.2.30.0040.00419.38
8.2.20.0070.00417.71
8.2.10.0040.00417.63
8.2.00.0030.00917.67
8.1.280.0070.00725.92
8.1.270.0080.00023.99
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0090.00922.05
8.1.230.0040.00719.00
8.1.220.0000.00817.78
8.1.210.0040.00418.77
8.1.200.0000.01117.13
8.1.190.0060.00317.23
8.1.180.0030.00518.10
8.1.170.0050.00518.59
8.1.160.0000.00718.89
8.1.150.0040.00418.81
8.1.140.0040.00417.45
8.1.130.0000.00717.42
8.1.120.0070.00017.41
8.1.110.0070.00017.43
8.1.100.0000.00817.36
8.1.90.0000.00817.52
8.1.80.0030.00417.52
8.1.70.0000.00717.39
8.1.60.0050.00317.53
8.1.50.0000.00817.59
8.1.40.0000.00817.43
8.1.30.0040.00417.53
8.1.20.0040.00817.67
8.1.10.0000.00717.51
8.1.00.0000.00817.48
8.0.300.0080.00018.77
8.0.290.0050.00316.75
8.0.280.0000.00718.42
8.0.270.0030.00317.35
8.0.260.0060.00018.51
8.0.250.0090.00016.97
8.0.240.0080.00016.95
8.0.230.0040.00416.96
8.0.220.0000.00816.90
8.0.210.0040.00416.90
8.0.200.0030.00316.86
8.0.190.0030.00317.02
8.0.180.0050.00316.86
8.0.170.0080.00016.92
8.0.160.0000.00716.93
8.0.150.0060.00316.70
8.0.140.0040.00416.74
8.0.130.0050.00013.20
8.0.120.0030.00516.91
8.0.110.0050.00316.77
8.0.100.0000.00716.84
8.0.90.0040.00416.96
8.0.80.0090.00616.96
8.0.70.0000.00716.76
8.0.60.0060.00316.95
8.0.50.0030.00516.94
8.0.30.0080.01117.25
8.0.20.0080.01317.02
8.0.10.0040.00416.80
8.0.00.0090.00816.62
7.4.330.0000.00512.99
7.4.320.0060.00016.61
7.4.300.0060.00016.55
7.4.290.0030.00916.41
7.4.280.0030.00416.54
7.4.270.0000.00816.54
7.4.260.0000.00513.32
7.4.250.0030.00616.61
7.4.240.0030.00316.55
7.4.230.0050.00216.48
7.4.220.0090.01816.56
7.4.210.0070.01016.54
7.4.200.0040.00316.61
7.4.190.0050.00316.77
7.4.160.0120.01516.29
7.4.150.0090.00916.58
7.4.140.0000.01717.86
7.4.130.0110.00616.64
7.4.120.0090.01216.68
7.4.110.0130.00616.32
7.4.100.0040.02016.55
7.4.90.0040.01916.37
7.4.80.0100.01319.39
7.4.70.0030.01316.51
7.4.60.0130.00316.60
7.4.50.0060.00316.56
7.4.40.0140.00416.39
7.4.30.0080.01416.54
7.4.10.0100.01016.18
7.4.00.0080.00815.36
7.3.330.0050.00213.24
7.3.320.0030.00313.21
7.3.310.0000.00716.23
7.3.300.0060.00016.34
7.3.290.0070.01116.46
7.3.280.0070.01116.29
7.3.270.0090.01016.27
7.3.260.0120.01216.55
7.3.240.0140.00316.68
7.3.230.0110.00616.63
7.3.210.0170.00016.48
7.3.200.0080.00816.61
7.3.190.0030.01416.63
7.3.180.0100.00616.30
7.3.170.0120.00616.46
7.3.160.0120.00616.58
7.3.130.0090.01216.48
7.3.120.0070.01015.20
7.3.110.0030.01415.46
7.3.100.0110.00615.47
7.3.90.0070.00815.47
7.3.80.0020.00915.42
7.3.70.0070.00615.33
7.3.60.0100.00515.27
7.3.50.0020.01015.43
7.3.40.0080.00615.37
7.3.30.0050.00715.31
7.3.20.0090.00617.12
7.3.10.0080.00617.09
7.3.00.0040.00917.05
7.2.330.0140.00316.71
7.2.320.0070.01416.63
7.2.310.0080.01416.85
7.2.300.0100.00716.96
7.2.290.0040.01516.86
7.2.260.0070.01316.55
7.2.250.0050.01315.59
7.2.240.0050.01315.47
7.2.230.0070.01015.63
7.2.220.0060.00715.59
7.2.210.0050.00715.49
7.2.200.0070.00715.55
7.2.190.0080.00815.61
7.2.180.0080.00415.53
7.2.170.0050.00815.50
7.2.160.0040.00915.82
7.2.150.0070.00717.61
7.2.140.0040.00917.58
7.2.130.0070.00817.39
7.2.120.0100.00417.34
7.2.110.0070.00617.33
7.2.100.0070.00817.45
7.2.90.0060.00817.31
7.2.80.0040.00917.42
7.2.70.0040.01017.32
7.2.60.0080.00617.35
7.2.50.0040.00917.35
7.2.40.0050.00917.48
7.2.30.0040.00917.38
7.2.20.0030.01117.44
7.2.10.0060.00817.41
7.2.00.0040.00917.77
7.1.330.0060.01116.32
7.1.320.0070.00716.44
7.1.310.0040.00916.44
7.1.300.0080.00916.27
7.1.290.0040.00816.41
7.1.280.0070.00516.33
7.1.270.0060.00716.35
7.1.260.0090.00516.35
7.1.250.0040.00816.34
7.1.240.0050.01116.58
7.1.230.0090.00516.38
7.1.220.0060.00616.61
7.1.210.0020.01016.63
7.1.200.0060.00316.45
7.1.190.0080.00316.54
7.1.180.0050.01016.57
7.1.170.0040.00816.54
7.1.160.0060.00616.59
7.1.150.0080.00516.60
7.1.140.0050.00616.64
7.1.130.0030.01216.56
7.1.120.0090.00216.57
7.1.110.0030.01116.58
7.1.100.0020.00917.02
7.1.90.0060.00616.66
7.1.80.0060.00416.55
7.1.70.0030.00616.71
7.1.60.0030.01217.50
7.1.50.0070.01016.56
7.1.40.0030.00616.57
7.1.30.0050.00716.52
7.1.20.0050.00816.63
7.1.10.0030.01016.55
7.1.00.0050.01818.54
7.0.330.0060.00816.31
7.0.320.0020.00916.13
7.0.310.0030.00816.15
7.0.300.0050.00716.11
7.0.290.0020.00916.05
7.0.280.0010.00716.15
7.0.270.0010.01316.23
7.0.260.0050.00716.25
7.0.250.0050.00616.18
7.0.240.0050.00816.32
7.0.230.0060.00816.20
7.0.220.0060.00616.15
7.0.210.0030.01016.32
7.0.200.0020.00716.44
7.0.190.0060.00616.20
7.0.180.0080.00416.29
7.0.170.0120.00016.09
7.0.160.0000.01116.19
7.0.150.0050.00616.34
7.0.140.0080.02718.09
7.0.130.0090.00416.23
7.0.120.0040.02917.98
7.0.110.0040.00916.29
7.0.100.0060.00816.26
7.0.90.0040.01116.15
7.0.80.0060.00816.24
7.0.70.0030.01016.29
7.0.60.0030.02617.39
7.0.50.0060.01716.82
7.0.40.0060.03416.15
7.0.30.0240.02616.20
7.0.20.0110.02316.21
7.0.10.0100.02516.18
7.0.00.0080.02016.17
5.6.400.0050.01015.17
5.6.390.0100.00315.01
5.6.380.0070.00915.14
5.6.370.0100.00515.12
5.6.360.0050.00515.27
5.6.350.0090.00715.06
5.6.340.0050.00815.25
5.6.330.0030.01214.93
5.6.320.0080.00815.27
5.6.310.0060.00815.25
5.6.300.0060.01015.11
5.6.290.0090.00915.00
5.6.280.0080.02717.22
5.6.270.0080.00715.22
5.6.260.0020.01015.02
5.6.250.0050.00915.27
5.6.240.0080.00515.24
5.6.230.0140.00215.24
5.6.220.0080.00615.06
5.6.210.0050.02016.90
5.6.200.0010.02216.34
5.6.190.0100.02117.01
5.6.180.0160.01617.02
5.6.170.0140.03417.01
5.6.160.0120.02616.97
5.6.150.0090.01716.22
5.6.140.0050.03216.21
5.6.130.0070.03316.13
5.6.120.0080.01717.08
5.6.110.0040.02217.04
5.6.100.0050.02117.12
5.6.90.0080.03117.21
5.6.80.0090.02616.93
5.6.70.0030.00915.17
5.6.60.0060.01115.07
5.6.50.0050.00815.07
5.6.40.0030.01015.12
5.6.30.0040.00814.98
5.6.20.0070.00815.05
5.6.10.0060.00615.05
5.6.00.0020.01314.94
5.5.380.0070.01214.96
5.5.370.0070.00615.04
5.5.360.0100.00315.04
5.5.350.0090.03016.93
5.5.340.0070.03315.94
5.5.330.0020.02016.84
5.5.320.0060.03316.81
5.5.310.0130.02816.76
5.5.300.0090.02916.02
5.5.290.0030.02316.09
5.5.280.0100.02817.04
5.5.270.0080.02316.97
5.5.260.0060.03017.01
5.5.250.0050.03016.95
5.5.240.1210.01816.74
5.5.230.0050.01014.99
5.5.220.0080.00614.93
5.5.210.0080.00514.94
5.5.200.0050.01115.21
5.5.190.0080.00514.81
5.5.180.0020.01414.96
5.5.170.0080.00714.94
5.5.160.0080.00914.93
5.5.150.0100.00814.96
5.5.140.0080.00715.04
5.5.130.0060.01115.19
5.5.120.0060.01115.19
5.5.110.0030.01015.26
5.5.100.0050.00815.04
5.5.90.0090.00614.84
5.5.80.0060.00915.05
5.5.70.0100.00714.94
5.5.60.0090.00814.73
5.5.50.0060.00715.04
5.5.40.0060.01115.06
5.5.30.0050.01114.88
5.5.20.0030.01114.81
5.5.10.0040.01015.07
5.5.00.0040.01215.03
5.4.450.0050.02814.72
5.4.440.0060.02014.69
5.4.430.0020.03414.68
5.4.420.0080.02314.67
5.4.410.0060.02814.67
5.4.400.0050.02314.56
5.4.390.0090.02014.45
5.4.380.0060.02914.58
5.4.370.0100.02914.44
5.4.360.0050.02614.46
5.4.350.0100.02814.58
5.4.340.0070.02914.45
5.4.330.0030.00912.25
5.4.320.0040.03014.54
5.4.310.0070.02814.48
5.4.300.0060.02014.43
5.4.290.0060.02814.63
5.4.280.0040.03214.57
5.4.270.0030.02314.54
5.4.260.0030.03214.52
5.4.250.0030.02914.64
5.4.240.0040.02014.59
5.4.230.0040.03414.65
5.4.220.0070.01714.62
5.4.210.0080.02814.51
5.4.200.0070.02714.57
5.4.190.0050.02814.54
5.4.180.0020.01914.52
5.4.170.0090.02714.44
5.4.160.0040.02714.46
5.4.150.0060.03014.47
5.4.140.0030.02113.68
5.4.130.0080.01913.66
5.4.120.0030.01913.67
5.4.110.0100.02213.72
5.4.100.0060.01613.71
5.4.90.0030.02613.63
5.4.80.0080.01713.74
5.4.70.0060.02113.69
5.4.60.0050.03013.62
5.4.50.0040.02413.63
5.4.40.0030.02813.68
5.4.30.0050.02013.63
5.4.20.0070.02813.66
5.4.10.0070.02513.67
5.4.00.0070.02613.52
5.3.290.0060.01913.27
5.3.280.0050.02813.16
5.3.270.0050.02113.28
5.3.260.0070.01813.21
5.3.250.0110.02113.20
5.3.240.0040.02613.18
5.3.230.0070.01613.23
5.3.220.0070.01913.18
5.3.210.0070.01813.26
5.3.200.0030.03013.09
5.3.190.0050.03013.22
5.3.180.0060.02813.19
5.3.170.0020.02213.33
5.3.160.0030.03213.23
5.3.150.0050.03013.24
5.3.140.0040.03013.22
5.3.130.0010.02913.18
5.3.120.0030.02113.12
5.3.110.0030.02013.17
5.3.100.0060.02013.00
5.3.90.0060.03013.05
5.3.80.0020.03113.00
5.3.70.0080.01713.01
5.3.60.0070.02513.02
5.3.50.0040.02712.96
5.3.40.0120.02713.00
5.3.30.0080.02412.98
5.3.20.0060.02412.94
5.3.10.0070.02612.85
5.3.00.0010.02312.86
5.2.170.0030.03711.11
5.2.160.0000.04011.16
5.2.150.0070.06311.06
5.2.140.0070.05711.31
5.2.130.0030.03711.17
5.2.120.0030.05011.20
5.2.110.0000.03311.27
5.2.100.0030.06311.12
5.2.90.0030.05711.12
5.2.80.0000.05311.29
5.2.70.0070.05711.27
5.2.60.0130.04311.03
5.2.50.0100.03711.18
5.2.40.0100.05311.18
5.2.30.0070.03311.03
5.2.20.0100.03010.94
5.2.10.0030.06010.89
5.2.00.0030.03710.66
5.1.60.0000.05710.08
5.1.50.0000.0579.93
5.1.40.0000.0509.99
5.1.30.0000.06710.35
5.1.20.0070.03310.37
5.1.10.0070.04310.11
5.1.00.0070.05710.14
5.0.50.0000.0278.60
5.0.40.0000.0378.42
5.0.30.0030.0338.32
5.0.20.0000.0308.21
5.0.10.0030.0378.16
5.0.00.0070.0378.16
4.4.90.0030.0338.02
4.4.80.0000.0208.02
4.4.70.0000.0178.02
4.4.60.0000.0178.02
4.4.50.0030.0338.02
4.4.40.0030.0278.02
4.4.30.0000.0378.02
4.4.20.0000.0378.02
4.4.10.0000.0278.02
4.4.00.0070.0338.02
4.3.110.0070.0178.02
4.3.100.0000.0178.02
4.3.90.0030.0238.02
4.3.80.0000.0278.02
4.3.70.0070.0178.02
4.3.60.0000.0208.02
4.3.50.0030.0278.02
4.3.40.0000.0438.02
4.3.30.0000.0378.02
4.3.20.0030.0308.02
4.3.10.0000.0408.02
4.3.00.0030.0278.02

preferences:
42.56 ms | 401 KiB | 5 Q