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); if (!is32Bit()) { $result = ($longs[0] << 32) | $longs[1]; if ($signBit) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } else { $result = 0; } return $result; } var_dump(unpack_int64("\x80\x00\x00\x00\x00\x00\x00\x01"));

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.00618.23
8.3.50.0080.01317.48
8.3.40.0160.00618.68
8.3.30.0120.00618.80
8.3.20.0050.00518.83
8.3.10.0030.00520.45
8.3.00.0040.00419.25
8.2.180.0060.01516.75
8.2.170.0160.00022.96
8.2.160.0070.00722.21
8.2.150.0120.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0030.00519.89
8.2.110.0070.00320.95
8.2.100.0090.00317.84
8.2.90.0030.00519.36
8.2.80.0000.00818.05
8.2.70.0030.00617.50
8.2.60.0040.00418.05
8.2.50.0080.00018.07
8.2.40.0030.00519.95
8.2.30.0040.00718.22
8.2.20.0000.00717.66
8.2.10.0000.00717.76
8.2.00.0040.00417.65
8.1.280.0090.00625.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0060.00322.57
8.1.230.0040.00820.93
8.1.220.0000.00817.76
8.1.210.0000.00918.96
8.1.200.0090.00017.38
8.1.190.0000.00817.53
8.1.180.0000.00818.10
8.1.170.0000.00918.89
8.1.160.0000.00718.92
8.1.150.0040.00418.78
8.1.140.0050.00217.57
8.1.130.0050.00317.87
8.1.120.0030.00317.49
8.1.110.0000.00717.48
8.1.100.0070.00017.53
8.1.90.0050.00217.48
8.1.80.0000.00717.53
8.1.70.0030.00317.44
8.1.60.0070.00017.50
8.1.50.0040.00417.52
8.1.40.0090.00017.47
8.1.30.0000.00817.57
8.1.20.0040.00417.65
8.1.10.0000.00817.63
8.1.00.0000.00917.47
8.0.300.0040.00419.94
8.0.290.0080.00016.75
8.0.280.0030.00318.39
8.0.270.0040.00417.16
8.0.260.0000.00718.49
8.0.250.0040.00416.98
8.0.240.0030.00616.94
8.0.230.0030.00316.92
8.0.220.0030.00316.96
8.0.210.0040.00416.90
8.0.200.0000.00617.01
8.0.190.0080.00016.97
8.0.180.0050.00216.88
8.0.170.0100.00016.87
8.0.160.0030.00316.92
8.0.150.0040.00416.94
8.0.140.0040.00316.79
8.0.130.0030.00313.36
8.0.120.0080.00016.87
8.0.110.0000.00716.88
8.0.100.0050.00216.82
8.0.90.0000.00716.91
8.0.80.0060.00916.88
8.0.70.0040.00416.72
8.0.60.0050.00316.82
8.0.50.0030.00516.83
8.0.30.0100.01117.13
8.0.20.0090.00917.40
8.0.10.0000.00816.91
8.0.00.0130.00616.78
7.4.330.0000.00614.70
7.4.320.0000.00716.62
7.4.300.0070.00016.55
7.4.290.0030.00316.67
7.4.280.0000.00816.66
7.4.270.0000.00616.64
7.4.260.0030.00313.27
7.4.250.0030.00516.43
7.4.240.0040.00416.46
7.4.230.0040.00416.45
7.4.220.0060.01216.63
7.4.210.0080.00916.61
7.4.200.0070.00016.61
7.4.190.0030.00316.43
7.4.160.0100.00716.53
7.4.150.0100.01117.40
7.4.140.0170.01617.21
7.4.130.0110.00916.45
7.4.120.0100.00916.52
7.4.110.0030.01316.44
7.4.100.0110.00616.50
7.4.90.0140.00416.77
7.4.80.0090.00918.80
7.4.70.0140.00316.38
7.4.60.0120.00616.38
7.4.50.0040.00416.51
7.4.40.0060.00822.27
7.4.30.0120.00416.54
7.4.10.0100.00814.98
7.4.00.0080.00915.10
7.3.330.0070.00013.24
7.3.320.0030.00313.34
7.3.310.0070.00016.34
7.3.300.0000.00616.40
7.3.290.0030.01716.39
7.3.280.0090.00916.40
7.3.270.0110.00617.40
7.3.260.0100.01118.24
7.3.250.0070.01116.67
7.3.240.0070.01116.69
7.3.230.0100.00716.46
7.3.210.0060.01016.64
7.3.200.0150.00819.39
7.3.190.0130.01016.40
7.3.180.0170.00316.36
7.3.170.0100.01016.44
7.3.160.0040.01216.73
7.3.130.0070.01015.00
7.3.120.0080.00914.78
7.3.110.0080.00714.89
7.3.100.0080.00614.84
7.3.90.0070.01014.83
7.3.80.0060.00914.83
7.3.70.0060.01014.77
7.3.60.0060.00614.70
7.3.50.0070.00814.95
7.3.40.0070.00614.76
7.3.30.0050.00714.82
7.3.20.0050.00716.69
7.3.10.0050.00716.64
7.3.00.0030.01016.74
7.2.330.0110.01116.81
7.2.320.0070.01116.46
7.2.310.0120.01216.54
7.2.300.0120.00916.74
7.2.290.0100.00616.64
7.2.260.0090.00515.03
7.2.250.0080.01015.20
7.2.240.0080.00715.15
7.2.230.0080.00714.96
7.2.220.0050.00715.02
7.2.210.0030.01215.14
7.2.200.0090.00915.08
7.2.190.0060.00714.93
7.2.180.0030.01014.97
7.2.170.0100.00715.11
7.2.160.0070.00915.06
7.2.150.0030.01016.88
7.2.140.0020.01016.88
7.2.130.0080.00717.02
7.2.120.0060.00917.00
7.2.110.0030.01016.91
7.2.100.0050.00916.93
7.2.90.0070.00717.04
7.2.80.0120.00516.65
7.2.70.0070.01016.92
7.2.60.0030.01016.78
7.2.50.0050.00516.79
7.2.40.0080.00716.95
7.2.30.0030.01016.90
7.2.20.0070.00816.84
7.2.10.0040.01316.91
7.2.00.0050.01017.83
7.1.330.0030.00915.86
7.1.320.0090.00315.78
7.1.310.0040.01215.87
7.1.300.0070.00615.79
7.1.290.0100.00615.79
7.1.280.0050.00915.88
7.1.270.0050.01015.69
7.1.260.0060.00515.74
7.1.250.0030.01015.87
7.1.240.0060.00615.73
7.1.230.0030.01115.69
7.1.220.0090.00815.74
7.1.210.0080.00615.81
7.1.200.0080.00415.71
7.1.190.0090.00515.69
7.1.180.0070.00615.79
7.1.170.0030.01015.80
7.1.160.0060.00815.77
7.1.150.0030.00815.77
7.1.140.0070.00615.86
7.1.130.0040.01215.70
7.1.120.0070.00815.55
7.1.110.0080.00715.75
7.1.100.0070.00816.60
7.1.90.0050.00715.91
7.1.80.0030.00915.82
7.1.70.0050.00816.32
7.1.60.0070.00916.99
7.1.50.0090.00716.25
7.1.40.0040.00915.81
7.1.30.0030.00815.74
7.1.20.0050.00515.90
7.1.10.0070.00615.78
7.1.00.0070.02318.03
7.0.330.0020.01215.36
7.0.320.0080.00815.34
7.0.310.0020.00815.30
7.0.300.0060.00715.46
7.0.290.0080.00515.54
7.0.280.0000.01215.62
7.0.270.0100.00415.42
7.0.260.0080.00315.35
7.0.250.0090.00515.52
7.0.240.0090.00515.51
7.0.230.0080.00115.38
7.0.220.0100.00215.51
7.0.210.0030.01215.26
7.0.200.0020.00815.80
7.0.190.0040.00915.52
7.0.180.0070.00615.22
7.0.170.0080.00415.45
7.0.160.0050.00615.54
7.0.150.0070.00315.42
7.0.140.0070.02917.55
7.0.130.0060.00315.38
7.0.120.0050.00815.43
7.0.110.0060.00815.45
7.0.100.0070.00515.45
7.0.90.0030.00715.43
7.0.80.0050.00615.29
7.0.70.0040.00815.57
7.0.60.0030.03116.94
7.0.50.0020.01816.37
7.0.40.0060.01514.98
7.0.30.0070.01914.93
7.0.20.0040.03014.90
7.0.10.0040.03114.96
7.0.00.0080.03014.75
5.6.400.0060.00714.53
5.6.390.0070.00714.36
5.6.380.0110.00514.28
5.6.370.0060.00814.58
5.6.360.0040.01214.39
5.6.350.0080.00714.48
5.6.340.0030.01214.41
5.6.330.0050.01014.53
5.6.320.0060.00914.37
5.6.310.0050.00814.40
5.6.300.0050.00914.34
5.6.290.0050.00814.58
5.6.280.0060.02716.79
5.6.270.0070.00614.44
5.6.260.0050.00614.54
5.6.250.0090.00314.37
5.6.240.0030.01014.28
5.6.230.0070.00614.21
5.6.220.0070.00514.40
5.6.210.0040.03416.45
5.6.200.0010.02315.64
5.6.190.0090.01415.71
5.6.180.0050.01615.80
5.6.170.0030.01915.68
5.6.160.0080.02515.58
5.6.150.0070.02515.61
5.6.140.0060.03215.77
5.6.130.0090.02815.73
5.6.120.0060.03415.71
5.6.110.0040.03515.62
5.6.100.0090.02115.65
5.6.90.0040.02815.79
5.6.80.0060.02015.42
5.6.70.0040.01815.46
5.6.60.0040.02115.46
5.6.50.0060.01615.45
5.6.40.0020.02215.41
5.6.30.0040.03315.51
5.6.20.0020.03315.42
5.6.10.0080.02915.40
5.6.00.0090.02815.40
5.5.380.0070.00514.31
5.5.370.0020.01114.42
5.5.360.0060.00414.40
5.5.350.0010.03516.38
5.5.340.0030.02115.70
5.5.330.0060.01615.77
5.5.320.0030.01715.59
5.5.310.0100.02915.51
5.5.300.0060.03215.65
5.5.290.0040.02115.49
5.5.280.0060.03315.66
5.5.270.0080.02915.37
5.5.260.0010.03115.66
5.5.250.0050.03215.45
5.5.240.0070.03015.33
5.5.230.0080.02615.20
5.5.220.0040.03315.35
5.5.210.0060.01915.22
5.5.200.0090.02815.20
5.5.190.0060.02515.14
5.5.180.0050.03115.43
5.5.170.0020.00914.18
5.5.160.0070.03015.24
5.5.150.0030.03215.38
5.5.140.0060.02615.42
5.5.130.0100.01615.37
5.5.120.0080.03015.18
5.5.110.0090.02515.26
5.5.100.0070.02815.33
5.5.90.0050.03115.20
5.5.80.0060.01915.31
5.5.70.0050.03015.25
5.5.60.0040.01915.33
5.5.50.0050.03315.32
5.5.40.0030.03215.26
5.5.30.0050.02715.13
5.5.20.0060.02715.37
5.5.10.0050.02315.28
5.5.00.0060.02515.33
5.4.450.0060.02214.46
5.4.440.0050.03214.31
5.4.430.0040.03114.36
5.4.420.0040.03214.41
5.4.410.0080.02614.38
5.4.400.0050.02214.29
5.4.390.0060.01614.42
5.4.380.0070.02314.25
5.4.370.0060.01414.24
5.4.360.0070.01414.14
5.4.350.0040.02714.22
5.4.340.0060.03014.21
5.4.330.0080.00411.90
5.4.320.0100.02214.21
5.4.310.0080.02014.17
5.4.300.0060.02914.30
5.4.290.0040.03214.35
5.4.280.0020.02814.25
5.4.270.0010.03114.38
5.4.260.0000.02814.28
5.4.250.0050.02814.32
5.4.240.0040.02914.28
5.4.230.0060.02114.30
5.4.220.0070.02814.38
5.4.210.0040.01614.22
5.4.200.0020.02714.27
5.4.190.0060.02914.20
5.4.180.0070.01714.27
5.4.170.0050.03014.31
5.4.160.0020.03314.20
5.4.150.0040.02914.13
5.4.140.0040.02913.35
5.4.130.0040.02113.38
5.4.120.0040.02113.36
5.4.110.0060.01713.35
5.4.100.0090.02113.42
5.4.90.0070.02413.23
5.4.80.0040.02813.41
5.4.70.0060.02313.42
5.4.60.0080.02713.42
5.4.50.0050.01613.28
5.4.40.0010.03213.38
5.4.30.0070.02713.38
5.4.20.0060.02513.43
5.4.10.0020.01813.40
5.4.00.0020.02113.18
5.3.290.0060.02812.65
5.3.280.0030.03012.61
5.3.270.0030.02112.65
5.3.260.0040.02912.65
5.3.250.0050.02812.64
5.3.240.0000.03112.51
5.3.230.0050.02812.65
5.3.220.0030.01812.54
5.3.210.0080.01612.65
5.3.200.0050.02812.58
5.3.190.0050.02712.63
5.3.180.0080.02212.57
5.3.170.0090.02612.60
5.3.160.0100.02112.65
5.3.150.0060.02912.55
5.3.140.0030.03112.65
5.3.130.0060.02312.61
5.3.120.0050.02812.63
5.3.110.0050.02612.59
5.3.100.0070.02612.39
5.3.90.0050.01912.52
5.3.80.0070.02612.37
5.3.70.0070.02512.40
5.3.60.0070.01712.44
5.3.50.0080.02812.44
5.3.40.0010.03212.50
5.3.30.0080.02612.45
5.3.20.0020.01912.23
5.3.10.0030.01812.17
5.3.00.0060.02612.21
5.2.170.0030.06711.21
5.2.160.0070.06311.38
5.2.150.0030.04011.20
5.2.140.0070.06011.20
5.2.130.0000.04711.34
5.2.120.0030.03011.14
5.2.110.0100.05311.13
5.2.100.0070.06011.17
5.2.90.0070.04311.14
5.2.80.0070.06010.96
5.2.70.0070.06011.16
5.2.60.0030.04311.08
5.2.50.0100.03711.08
5.2.40.0030.06311.24
5.2.30.0070.05711.02
5.2.20.0070.05710.83
5.2.10.0000.06010.99
5.2.00.0000.06710.84
5.1.60.0000.0339.91
5.1.50.0070.04010.00
5.1.40.0030.05310.05
5.1.30.0030.06310.26
5.1.20.0070.04310.50
5.1.10.0030.05010.08
5.1.00.0030.05310.20
5.0.50.0070.0439.29
5.0.40.0030.0409.29
5.0.30.0000.0539.29
5.0.20.0000.0309.29
5.0.10.0000.0509.29
5.0.00.0030.0639.29
4.4.90.0000.0379.29
4.4.80.0000.0209.29
4.4.70.0000.0379.29
4.4.60.0000.0379.29
4.4.50.0030.0379.29
4.4.40.0030.0579.29
4.4.30.0100.0339.29
4.4.20.0030.0339.29
4.4.10.0070.0309.29
4.4.00.0070.0479.29
4.3.110.0030.0179.29
4.3.100.0030.0339.29
4.3.90.0030.0209.29
4.3.80.0030.0339.29
4.3.70.0000.0209.29
4.3.60.0070.0339.29
4.3.50.0070.0309.29
4.3.40.0030.0509.29
4.3.30.0030.0339.29
4.3.20.0030.0339.29
4.3.10.0000.0239.29
4.3.00.0030.0209.29

preferences:
48.89 ms | 401 KiB | 5 Q