3v4l.org

run code in 300+ PHP versions simultaneously
<?php const INT_SIGNED = 1; const INT_LE = 2; function byteswap($str) { return str_reverse($str); } 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 = current(unpack('N', $str)); $signBit = (bool) ($result & 0x80000000); $isSigned = (bool) ($flags & INT_SIGNED); $is32bit = PHP_INT_MAX < 0x80000000; if ($signBit && $isSigned && !$is32bit) { $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); } $is32bit = PHP_INT_MAX < 0x80000000; 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 (PHP_INT_MAX > 0x7FFFFFFF) { $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.0090.00616.63
8.3.50.0080.01021.96
8.3.40.0040.01118.54
8.3.30.0000.01419.23
8.3.20.0000.00820.40
8.3.10.0050.00323.84
8.3.00.0060.00319.25
8.2.180.0080.00818.39
8.2.170.0130.00322.96
8.2.160.0070.00720.47
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.43
8.2.110.0070.01422.24
8.2.100.0070.00417.91
8.2.90.0050.00319.20
8.2.80.0040.00418.05
8.2.70.0050.00317.50
8.2.60.0000.00817.93
8.2.50.0000.00818.07
8.2.40.0040.00418.09
8.2.30.0040.00418.21
8.2.20.0080.00017.88
8.2.10.0050.00318.07
8.2.00.0030.00617.89
8.1.280.0070.01325.92
8.1.270.0050.00324.01
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00324.02
8.1.230.0030.00719.21
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0040.00417.35
8.1.190.0080.00017.53
8.1.180.0040.00418.10
8.1.170.0060.00318.71
8.1.160.0040.00422.02
8.1.150.0080.00018.66
8.1.140.0000.00717.62
8.1.130.0000.00817.93
8.1.120.0040.00417.56
8.1.110.0050.00217.50
8.1.100.0030.00517.53
8.1.90.0040.00417.43
8.1.80.0040.00417.54
8.1.70.0000.00817.54
8.1.60.0000.00817.66
8.1.50.0050.00317.50
8.1.40.0000.00817.48
8.1.30.0080.00017.59
8.1.20.0070.00017.72
8.1.10.0060.00317.52
8.1.00.0020.00517.55
8.0.300.0040.00418.77
8.0.290.0000.00717.18
8.0.280.0030.00318.40
8.0.270.0030.00317.34
8.0.260.0030.00316.83
8.0.250.0030.00317.03
8.0.240.0030.00317.07
8.0.230.0070.00017.05
8.0.220.0000.00717.00
8.0.210.0050.00216.84
8.0.200.0000.00616.92
8.0.190.0040.00416.95
8.0.180.0070.00017.00
8.0.170.0040.00416.89
8.0.160.0070.00016.99
8.0.150.0000.00916.96
8.0.140.0040.00416.91
8.0.130.0000.00613.43
8.0.120.0040.00416.85
8.0.110.0000.00716.98
8.0.100.0000.00717.04
8.0.90.0040.00416.88
8.0.80.0030.01016.97
8.0.70.0030.00516.83
8.0.60.0040.00416.99
8.0.50.0050.00216.81
8.0.30.0100.01017.29
8.0.20.0090.01017.45
8.0.10.0030.00517.13
8.0.00.0090.00916.92
7.4.330.0000.00715.29
7.4.320.0000.00616.49
7.4.300.0060.00016.54
7.4.290.0030.00616.57
7.4.280.0030.00316.59
7.4.270.0030.00316.61
7.4.260.0050.00216.61
7.4.250.0000.00816.70
7.4.240.0020.00516.64
7.4.230.0000.00816.72
7.4.220.0100.01316.72
7.4.210.0110.00416.62
7.4.200.0040.00416.78
7.4.190.0000.00716.78
7.4.160.0100.00616.59
7.4.150.0060.01117.40
7.4.140.0070.01017.86
7.4.130.0090.00816.49
7.4.120.0130.00416.53
7.4.110.0080.01216.70
7.4.100.0160.00316.59
7.4.90.0100.00716.48
7.4.80.0080.00919.39
7.4.70.0060.01616.71
7.4.60.0070.01116.64
7.4.50.0050.00016.53
7.4.40.0040.01522.77
7.4.30.0120.00616.57
7.4.00.0060.00915.12
7.3.330.0050.00013.26
7.3.320.0060.00013.42
7.3.310.0000.00916.34
7.3.300.0000.00716.45
7.3.290.0080.00816.45
7.3.280.0080.01016.48
7.3.270.0120.00617.40
7.3.260.0080.00816.60
7.3.250.0090.00916.64
7.3.240.0090.00916.43
7.3.230.0130.00316.49
7.3.210.0100.00716.52
7.3.200.0090.00619.39
7.3.190.0090.00916.65
7.3.180.0060.00916.75
7.3.170.0120.00616.52
7.3.160.0130.00316.50
7.3.120.0000.01415.23
7.2.330.0110.01116.86
7.2.320.0110.00716.79
7.2.310.0060.01016.78
7.2.300.0140.00416.71
7.2.290.0120.01116.67
7.2.00.0060.00919.35
7.1.100.0000.01118.13
7.1.70.0030.00717.36
7.1.60.0100.01319.33
7.1.50.0130.00916.86
7.1.00.0070.07322.70
7.0.200.0060.00616.67
7.0.140.0130.06321.95
7.0.100.0100.07320.09
7.0.90.0330.07320.14
7.0.80.0030.08720.06
7.0.70.0330.07320.02
7.0.60.0030.08320.06
7.0.50.0400.06320.48
7.0.40.0030.07720.18
7.0.30.0100.07720.13
7.0.20.0100.07320.23
7.0.10.0100.07720.25
7.0.00.0100.07020.28
5.6.280.0130.06321.24
5.6.250.0100.07720.88
5.6.240.0070.07320.80
5.6.230.0100.07320.73
5.6.220.0070.09020.60
5.6.210.0100.08320.76
5.6.200.0070.08021.17
5.6.190.0000.09321.22
5.6.180.0100.07721.13
5.6.170.0070.09021.12
5.6.160.0230.06721.25
5.6.150.0130.08021.18
5.6.140.0130.07321.22
5.6.130.0130.08321.16
5.6.120.0100.07321.13
5.6.110.0100.07021.13
5.6.100.0230.06021.13
5.6.90.0100.08021.23
5.6.80.0070.07720.61
5.6.70.0100.07720.51
5.6.60.0100.06020.49
5.6.50.0030.08320.67
5.6.40.0230.06320.58
5.6.30.0170.07020.58
5.6.20.0100.07320.61
5.6.10.0070.08320.43
5.6.00.0070.09320.57
5.5.380.0100.06020.55
5.5.370.0070.07720.50
5.5.360.0130.07720.45
5.5.350.0100.08020.44
5.5.340.0030.08320.97
5.5.330.0070.08021.11
5.5.320.0000.09021.08
5.5.310.0130.05720.84
5.5.300.0100.07320.94
5.5.290.0130.06320.98
5.5.280.0100.07720.98
5.5.270.0030.05021.10
5.5.260.0130.07320.93
5.5.250.0070.07320.92
5.5.240.0130.07320.36
5.5.230.0000.07720.35
5.5.220.0000.08720.25
5.5.210.0130.07720.21
5.5.200.0030.08320.33
5.5.190.0170.07720.19
5.5.180.0100.07720.32
5.5.160.0130.07020.32
5.5.150.0130.07720.27
5.5.140.0200.07020.23
5.5.130.0030.04720.32
5.5.120.0100.07020.23
5.5.110.0070.08320.46
5.5.100.0170.05720.18
5.5.90.0070.06720.21
5.5.80.0070.07720.13
5.5.70.0130.05020.11
5.5.60.0030.08020.24
5.5.50.0170.07020.25
5.5.40.0030.06720.23
5.5.30.0070.03720.21
5.5.20.0000.04320.25
5.5.10.0030.03720.15
5.5.00.0030.04020.21
5.4.450.0170.07319.43
5.4.440.0070.08019.41
5.4.430.0070.07319.29
5.4.420.0170.08019.46
5.4.410.0070.07719.32
5.4.400.0130.06718.96
5.4.390.0070.04319.05
5.4.380.0000.08019.14
5.4.370.0070.06719.14
5.4.360.0030.08019.01
5.4.350.0130.07018.86
5.4.340.0200.06018.93
5.4.320.0130.07318.90
5.4.310.0030.05318.95
5.4.300.0100.07719.04
5.4.290.0030.07318.85
5.4.280.0070.07319.12
5.4.270.0230.06019.15
5.4.260.0100.07319.18
5.4.250.0030.07718.94
5.4.240.0030.07319.07
5.4.230.0070.03719.10
5.4.220.0100.03719.13
5.4.210.0070.07719.08
5.4.200.0130.05019.09
5.4.190.0170.03719.22
5.4.180.0070.03718.98
5.4.170.0030.05019.21
5.4.160.0070.03719.11
5.4.150.0130.03019.18
5.4.140.0000.04016.50
5.4.130.0030.03016.54
5.4.120.0030.03316.48
5.4.110.0030.06016.49
5.4.100.0070.03016.49
5.4.90.0100.06316.41
5.4.80.0030.03716.40
5.4.70.0070.03316.43
5.4.60.0030.03316.47
5.4.50.0030.05716.34
5.4.40.0030.03716.43
5.4.30.0070.03316.36
5.4.20.0100.03316.45
5.4.10.0000.04016.31
5.4.00.0000.03715.86
5.3.290.0130.07014.80
5.3.280.0130.05314.67
5.3.270.0000.04014.55
5.3.260.0030.03714.60
5.3.250.0030.05314.73
5.3.240.0000.04714.70
5.3.230.0030.03714.60
5.3.220.0030.04714.69
5.3.210.0070.03014.56
5.3.200.0000.04314.57
5.3.190.0030.07314.53
5.3.180.0000.03714.60
5.3.170.0000.04014.70
5.3.160.0100.02714.58
5.3.150.0100.04714.61
5.3.140.0030.04014.64
5.3.130.0000.03714.57
5.3.120.0070.03714.61
5.3.110.0070.03714.70
5.3.100.0000.04014.07
5.3.90.0070.03014.02
5.3.80.0000.04013.96
5.3.70.0000.06314.01
5.3.60.0000.04014.04
5.3.50.0030.03713.99
5.3.40.0030.03713.90
5.3.30.0070.03313.98
5.3.20.0030.03013.62
5.3.10.0030.04013.68
5.3.00.0030.03313.76
5.2.170.0030.03711.07
5.2.160.0000.03011.13
5.2.150.0000.03011.13
5.2.140.0000.03011.19
5.2.130.0000.03011.12
5.2.120.0000.03011.13
5.2.110.0000.02710.96
5.2.100.0070.02310.96
5.2.90.0070.04011.05
5.2.80.0000.04711.01
5.2.70.0030.04011.14
5.2.60.0000.03010.91
5.2.50.0000.03010.97
5.2.40.0070.02710.91
5.2.30.0000.03010.96
5.2.20.0000.03711.02
5.2.10.0030.02710.86
5.2.00.0070.05710.78
5.1.60.0030.02310.00
5.1.50.0030.0209.98
5.1.40.0030.0209.98
5.1.30.0100.02010.39
5.1.20.0030.02710.27
5.1.10.0000.0639.91
5.1.00.0000.05310.06
5.0.50.0070.0438.59
5.0.40.0030.0438.45
5.0.30.0070.0278.27
5.0.20.0030.0508.20
5.0.10.0100.0408.23
5.0.00.0000.0638.24
4.4.90.0000.0208.05
4.4.80.0000.0178.05
4.4.70.0000.0208.05
4.4.60.0000.0208.05
4.4.50.0000.0178.05
4.4.40.0030.0208.05
4.4.30.0000.0208.05
4.4.20.0000.0308.05
4.4.10.0000.0338.05
4.4.00.0070.0478.05
4.3.110.0000.0378.05
4.3.100.0000.0378.05
4.3.90.0030.0278.05
4.3.80.0030.0538.05
4.3.70.0000.0378.05
4.3.60.0030.0338.05
4.3.50.0030.0338.05
4.3.40.0030.0538.05
4.3.30.0030.0278.05
4.3.20.0070.0338.05
4.3.10.0030.0238.05
4.3.00.0070.0308.05

preferences:
32.8 ms | 401 KiB | 5 Q