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) { echo '64'; $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); } 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 (!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.0170.00018.55
8.3.50.0120.00921.98
8.3.40.0120.00918.82
8.3.30.0090.00618.85
8.3.20.0080.00018.88
8.3.10.0080.00021.22
8.3.00.0030.00521.90
8.2.180.0120.00616.63
8.2.170.0110.00422.96
8.2.160.0030.01320.49
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0000.00821.05
8.2.110.0060.00320.44
8.2.100.0000.01117.84
8.2.90.0090.00019.22
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0040.00418.05
8.2.50.0040.00418.07
8.2.40.0030.00518.16
8.2.30.0000.00821.31
8.2.20.0040.00417.77
8.2.10.0000.00717.68
8.2.00.0000.00917.83
8.1.280.0100.00325.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0030.00722.45
8.1.230.0080.00321.04
8.1.220.0040.00418.77
8.1.210.0050.00318.88
8.1.200.0030.00617.23
8.1.190.0040.00417.43
8.1.180.0040.00418.10
8.1.170.0000.00818.71
8.1.160.0000.00718.86
8.1.150.0000.01018.74
8.1.140.0080.00017.60
8.1.130.0000.00717.89
8.1.120.0040.00417.57
8.1.110.0000.00717.58
8.1.100.0040.00417.61
8.1.90.0070.00017.57
8.1.80.0030.00517.60
8.1.70.0070.00017.53
8.1.60.0030.00617.57
8.1.50.0060.00317.64
8.1.40.0000.00917.64
8.1.30.0040.00417.80
8.1.20.0030.00517.73
8.1.10.0080.00017.64
8.1.00.0030.00517.53
8.0.300.0040.00420.02
8.0.290.0000.00817.18
8.0.280.0070.00018.55
8.0.270.0000.00817.36
8.0.260.0000.00616.90
8.0.250.0000.00817.04
8.0.240.0000.00917.06
8.0.230.0030.00317.09
8.0.220.0000.00717.06
8.0.210.0000.00917.00
8.0.200.0050.00516.96
8.0.190.0040.00417.08
8.0.180.0080.00017.04
8.0.170.0000.00716.99
8.0.160.0040.00417.03
8.0.150.0060.00316.84
8.0.140.0000.00716.85
8.0.130.0030.00313.38
8.0.120.0080.00016.85
8.0.110.0040.00416.92
8.0.100.0070.00016.96
8.0.90.0070.00016.89
8.0.80.0110.00716.91
8.0.70.0040.00416.94
8.0.60.0000.00816.87
8.0.50.0000.00817.03
8.0.30.0080.01116.99
8.0.20.0140.00717.40
8.0.10.0040.00416.99
8.0.00.0080.01016.79
7.4.330.0000.00616.84
7.4.320.0060.00016.62
7.4.300.0040.00416.73
7.4.290.0030.00316.71
7.4.280.0030.00316.45
7.4.270.0000.00716.71
7.4.260.0060.00013.36
7.4.250.0070.00016.67
7.4.240.0040.00416.62
7.4.230.0070.00016.44
7.4.220.0170.00816.54
7.4.210.0080.00816.68
7.4.200.0030.00316.59
7.4.190.0040.00416.41
7.4.160.0070.01016.62
7.4.150.0070.01317.40
7.4.140.0100.01117.86
7.4.130.0150.00516.58
7.4.120.0100.00816.55
7.4.110.0150.00916.47
7.4.100.0040.01416.60
7.4.90.0120.00616.43
7.4.80.0160.00319.39
7.4.70.0110.00716.74
7.4.60.0090.00616.46
7.4.50.0070.00316.41
7.4.40.0110.00422.77
7.4.30.0140.01016.38
7.4.10.0090.00914.88
7.4.00.0070.00915.01
7.3.330.0000.00613.44
7.3.320.0050.00013.42
7.3.310.0000.00716.54
7.3.300.0030.00316.38
7.3.290.0070.00716.41
7.3.280.0110.00516.40
7.3.270.0100.00617.40
7.3.260.0140.01018.24
7.3.250.0080.01016.62
7.3.240.0100.00716.48
7.3.230.0100.00716.66
7.3.210.0090.00916.70
7.3.200.0130.01219.39
7.3.190.0030.01516.66
7.3.180.0150.00016.31
7.3.170.0140.00716.56
7.3.160.0100.00716.60
7.3.130.0100.00814.99
7.3.120.0060.01014.76
7.3.110.0050.01114.86
7.3.100.0050.00714.99
7.3.90.0070.00614.91
7.3.80.0040.00915.01
7.3.70.0050.00914.99
7.3.60.0040.00914.89
7.3.50.0030.01014.93
7.3.40.0070.00614.99
7.3.30.0070.00714.85
7.3.20.0060.00616.63
7.3.10.0030.00816.67
7.3.00.0050.00716.74
7.2.330.0130.00716.51
7.2.320.0070.01116.73
7.2.310.0110.00716.57
7.2.300.0120.00916.71
7.2.290.0120.00616.60
7.2.260.0080.01015.22
7.2.250.0060.01115.34
7.2.240.0080.00914.98
7.2.230.0080.00615.21
7.2.220.0110.00315.06
7.2.210.0030.01115.21
7.2.200.0050.00915.16
7.2.190.0080.00615.14
7.2.180.0030.00814.99
7.2.170.0070.00614.92
7.2.160.0070.00915.09
7.2.150.0020.01316.89
7.2.140.0070.00516.88
7.2.130.0030.00917.08
7.2.120.0100.00616.89
7.2.110.0120.00016.82
7.2.100.0050.00816.93
7.2.90.0060.00816.97
7.2.80.0060.00916.86
7.2.70.0050.00716.83
7.2.60.0050.00916.89
7.2.50.0030.00917.05
7.2.40.0030.00817.07
7.2.30.0040.01017.03
7.2.20.0030.00717.04
7.2.10.0070.00216.97
7.2.00.0040.00817.71
7.1.330.0040.01015.85
7.1.320.0060.00715.99
7.1.310.0060.00716.08
7.1.300.0100.00515.92
7.1.290.0050.00715.86
7.1.280.0060.00615.92
7.1.270.0030.00915.89
7.1.260.0040.00715.92
7.1.250.0020.00715.92
7.1.240.0030.01015.94
7.1.230.0060.00715.87
7.1.220.0020.01215.86
7.1.210.0090.00515.66
7.1.200.0030.00915.84
7.1.190.0080.00615.71
7.1.180.0030.01015.80
7.1.170.0060.00715.71
7.1.160.0080.00415.87
7.1.150.0050.00915.60
7.1.140.0020.00915.67
7.1.130.0060.00715.91
7.1.120.0040.01115.94
7.1.110.0050.00915.85
7.1.100.0040.01016.67
7.1.90.0110.00315.92
7.1.80.0020.01015.90
7.1.70.0040.00716.33
7.1.60.0060.01116.86
7.1.50.0080.00916.27
7.1.40.0040.00415.72
7.1.30.0010.01015.76
7.1.20.0040.00815.90
7.1.10.0060.00815.95
7.1.00.0070.01318.03
7.0.330.0040.00715.57
7.0.320.0040.00615.35
7.0.310.0040.00915.51
7.0.300.0040.00915.58
7.0.290.0020.00715.40
7.0.280.0020.01015.52
7.0.270.0020.01315.51
7.0.260.0070.00515.42
7.0.250.0060.00715.55
7.0.240.0020.01215.54
7.0.230.0030.01215.50
7.0.220.0050.00515.44
7.0.210.0020.01015.63
7.0.200.0070.00615.95
7.0.190.0050.00815.60
7.0.180.0040.01015.51
7.0.170.0060.01015.45
7.0.160.0070.00715.51
7.0.150.0060.00515.41
7.0.140.0040.02917.84
7.0.130.0120.00215.61
7.0.120.0020.00815.41
7.0.110.0060.00615.58
7.0.100.0060.00615.47
7.0.90.0050.00715.52
7.0.80.0050.00515.46
7.0.70.0060.00615.45
7.0.60.0040.03217.21
7.0.50.0070.02416.40
7.0.40.0050.02415.84
7.0.30.0130.02915.89
7.0.20.0100.02815.82
7.0.10.0070.03115.77
7.0.00.0030.03015.75
5.6.400.0080.00414.37
5.6.390.0080.00514.62
5.6.380.0050.00714.49
5.6.370.0050.00814.17
5.6.360.0070.00514.39
5.6.350.0080.00514.13
5.6.340.0030.00814.64
5.6.330.0060.00514.29
5.6.320.0050.00814.68
5.6.310.0060.00914.61
5.6.300.0080.00514.45
5.6.290.0050.00714.33
5.6.280.0070.02816.71
5.6.270.0080.00814.30
5.6.260.0040.00814.36
5.6.250.0030.01114.36
5.6.240.0020.00814.40
5.6.230.0060.00614.39
5.6.220.0070.00614.43
5.6.210.0050.02516.41
5.6.200.0090.02515.75
5.6.190.0030.02416.31
5.6.180.0100.01716.61
5.6.170.0140.03216.39
5.6.160.0060.03416.38
5.6.150.0050.03215.52
5.6.140.0060.03015.81
5.6.130.0100.03115.68
5.6.120.0070.01816.52
5.6.110.0070.01816.77
5.6.100.0080.03016.61
5.6.90.0040.03816.67
5.6.80.0000.02216.34
5.6.70.0050.01416.31
5.6.60.0040.01014.36
5.6.50.0050.00914.09
5.6.40.0080.00514.29
5.6.30.0060.00914.30
5.6.20.0050.01114.40
5.6.10.0070.00714.36
5.6.00.0040.00914.34
5.5.380.0030.00514.33
5.5.370.0060.00714.44
5.5.360.0000.01314.25
5.5.350.0080.03016.43
5.5.340.0060.03015.53
5.5.330.0080.03116.19
5.5.320.0150.02616.33
5.5.310.0150.02516.40
5.5.300.0080.02915.75
5.5.290.0060.02615.64
5.5.280.0060.03316.68
5.5.270.0080.02816.59
5.5.260.0100.03116.53
5.5.250.0070.03216.53
5.5.240.0090.03116.35
5.5.230.0040.00914.41
5.5.220.0050.00914.12
5.5.210.0060.00614.22
5.5.200.0050.00714.50
5.5.190.0100.00414.41
5.5.180.0090.00714.25
5.5.170.0050.00414.20
5.5.160.0060.00814.02
5.5.150.0050.00614.38
5.5.140.0020.01214.10
5.5.130.0050.00714.31
5.5.120.0070.00914.52
5.5.110.0040.00914.34
5.5.100.0060.00713.97
5.5.90.0100.00614.34
5.5.80.0050.00814.22
5.5.70.0070.00714.11
5.5.60.0080.00714.09
5.5.50.0110.00414.15
5.5.40.0070.00714.31
5.5.30.0060.00514.12
5.5.20.0050.00714.47
5.5.10.0090.00414.11
5.5.00.0050.00914.39
5.4.450.0030.03314.74
5.4.440.0000.02414.71
5.4.430.0050.02914.65
5.4.420.0050.02814.67
5.4.410.0050.03114.58
5.4.400.0050.02014.56
5.4.390.0040.02914.58
5.4.380.0030.02914.55
5.4.370.0050.01614.58
5.4.360.0030.03114.44
5.4.350.0040.02814.41
5.4.340.0020.03014.58
5.4.330.0040.00412.21
5.4.320.0050.02914.42
5.4.310.0030.02014.36
5.4.300.0050.02514.48
5.4.290.0020.02114.54
5.4.280.0060.02614.52
5.4.270.0020.02214.59
5.4.260.0020.03114.41
5.4.250.0060.02714.48
5.4.240.0030.02614.55
5.4.230.0030.02914.40
5.4.220.0050.02814.54
5.4.210.0050.02914.35
5.4.200.0090.02114.59
5.4.190.0050.01914.63
5.4.180.0070.02114.47
5.4.170.0030.02114.46
5.4.160.0020.02614.49
5.4.150.0030.02014.49
5.4.140.0010.02413.65
5.4.130.0030.02313.68
5.4.120.0040.02413.65
5.4.110.0090.01613.73
5.4.100.0030.02213.49
5.4.90.0040.02313.61
5.4.80.0010.02213.52
5.4.70.0020.02513.58
5.4.60.0020.02713.57
5.4.50.0050.02613.68
5.4.40.0080.01813.73
5.4.30.0050.01913.59
5.4.20.0040.02913.72
5.4.10.0060.02213.62
5.4.00.0050.02713.34
5.3.290.0050.01912.94
5.3.280.0070.01512.84
5.3.270.0050.03112.92
5.3.260.0000.03012.77
5.3.250.0070.01212.86
5.3.240.0100.01812.85
5.3.230.0030.02712.81
5.3.220.0010.02112.90
5.3.210.0060.02812.89
5.3.200.0060.01912.75
5.3.190.0020.02612.81
5.3.180.0020.02512.88
5.3.170.0030.02412.92
5.3.160.0020.03012.85
5.3.150.0050.01912.79
5.3.140.0050.02212.75
5.3.130.0040.02912.83
5.3.120.0040.03012.74
5.3.110.0040.02812.74
5.3.100.0010.03012.70
5.3.90.0040.02612.73
5.3.80.0060.02412.57
5.3.70.0010.02812.66
5.3.60.0030.02012.57
5.3.50.0020.02812.65
5.3.40.0000.02512.67
5.3.30.0070.02712.59
5.3.20.0050.02612.65
5.3.10.0060.02112.46
5.3.00.0030.03112.42
5.2.170.0100.05012.38
5.2.160.0030.06012.38
5.2.150.0000.06712.38
5.2.140.0030.06012.38
5.2.130.0000.06712.38
5.2.120.0000.05712.38
5.2.110.0030.05312.38
5.2.100.0030.05712.38
5.2.90.0030.04012.38
5.2.80.0030.06312.38
5.2.70.0030.05312.38
5.2.60.0000.07012.38
5.2.50.0030.05012.38
5.2.40.0030.05012.38
5.2.30.0000.06312.38
5.2.20.0030.05712.38
5.2.10.0030.05712.38
5.2.00.0070.05712.38
5.1.60.0000.05312.38
5.1.50.0030.04312.38
5.1.40.0030.04312.38
5.1.30.0000.06312.38
5.1.20.0130.04312.38
5.1.10.0070.04712.38
5.1.00.0030.05312.38
5.0.50.0000.04712.38
5.0.40.0000.03312.38
5.0.30.0070.06012.38
5.0.20.0000.04012.38
5.0.10.0030.03712.38
5.0.00.0000.04712.38
4.4.90.0000.03312.38
4.4.80.0030.03312.38
4.4.70.0070.02712.38
4.4.60.0030.03312.38
4.4.50.0000.03712.38
4.4.40.0000.05712.38
4.4.30.0030.02012.38
4.4.20.0000.03012.38
4.4.10.0030.03312.38
4.4.00.0000.05312.38
4.3.110.0000.03712.38
4.3.100.0070.03012.38
4.3.90.0000.03012.38
4.3.80.0030.05312.38
4.3.70.0030.02712.38
4.3.60.0070.02012.38
4.3.50.0030.03312.38
4.3.40.0030.05012.38
4.3.30.0030.03312.38
4.3.20.0000.03012.38
4.3.10.0070.03012.38
4.3.00.0030.03312.38

preferences:
46.12 ms | 401 KiB | 5 Q