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('NN', $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; } } return $result; } var_dump(unpack_int64("\x00\x00\x00\x00\x00\x00\x00\x01", 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.0110.00716.50
8.3.50.0210.01222.09
8.3.40.0120.00318.97
8.3.30.0070.01019.01
8.3.20.0050.00320.16
8.3.10.0080.00023.70
8.3.00.0040.00420.46
8.2.180.0040.01118.29
8.2.170.0140.00422.96
8.2.160.0120.00322.13
8.2.150.0040.00424.18
8.2.140.0090.00624.66
8.2.130.0070.00026.16
8.2.120.0080.00022.14
8.2.110.0030.00622.21
8.2.100.0040.00817.91
8.2.90.0080.00019.21
8.2.80.0040.00418.05
8.2.70.0060.00317.75
8.2.60.0000.00817.93
8.2.50.0090.00018.07
8.2.40.0040.00419.39
8.2.30.0040.00418.23
8.2.20.0040.00417.81
8.2.10.0000.00817.82
8.2.00.0000.00817.84
8.1.280.0140.00725.92
8.1.270.0080.00023.75
8.1.260.0000.00826.35
8.1.250.0150.00328.09
8.1.240.0060.00323.87
8.1.230.0110.00019.01
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0080.00017.34
8.1.190.0000.00817.41
8.1.180.0000.00818.10
8.1.170.0000.00818.64
8.1.160.0000.00721.93
8.1.150.0070.00018.78
8.1.140.0040.00417.40
8.1.130.0030.00317.86
8.1.120.0000.00917.47
8.1.110.0070.00317.46
8.1.100.0040.00417.50
8.1.90.0040.00417.39
8.1.80.0000.00717.50
8.1.70.0000.00817.39
8.1.60.0060.00317.66
8.1.50.0040.00417.61
8.1.40.0000.00717.59
8.1.30.0030.00517.66
8.1.20.0020.00517.66
8.1.10.0040.00417.49
8.1.00.0040.00417.39
8.0.300.0000.00718.77
8.0.290.0070.00017.18
8.0.280.0030.00318.43
8.0.270.0000.00817.30
8.0.260.0030.00316.90
8.0.250.0030.00317.10
8.0.240.0030.00617.06
8.0.230.0030.00516.96
8.0.220.0070.00016.93
8.0.210.0070.00017.04
8.0.200.0000.00716.94
8.0.190.0040.00416.98
8.0.180.0000.00717.09
8.0.170.0040.00417.05
8.0.160.0040.00416.87
8.0.150.0040.00416.98
8.0.140.0000.00816.95
8.0.130.0030.00313.40
8.0.120.0050.00316.84
8.0.110.0000.00817.06
8.0.100.0000.00816.95
8.0.90.0000.00716.77
8.0.80.0070.00817.03
8.0.70.0000.00716.98
8.0.60.0000.00717.01
8.0.50.0040.00416.95
8.0.30.0130.00717.21
8.0.20.0140.00717.42
8.0.10.0000.00716.98
8.0.00.0130.00516.89
7.4.330.0000.00515.00
7.4.320.0000.00716.50
7.4.300.0030.00316.66
7.4.290.0070.00016.58
7.4.280.0050.00316.53
7.4.270.0030.00516.50
7.4.260.0000.00716.57
7.4.250.0030.00316.52
7.4.240.0030.00416.51
7.4.230.0030.00316.29
7.4.220.0100.01616.67
7.4.210.0130.00316.58
7.4.200.0030.00316.55
7.4.190.0000.00716.61
7.4.160.0110.00616.59
7.4.150.0130.00617.40
7.4.140.0110.00817.86
7.4.130.0060.01316.65
7.4.120.0090.00916.52
7.4.110.0030.01316.41
7.4.100.0090.01216.70
7.4.90.0110.00716.38
7.4.80.0150.00316.45
7.4.70.0070.01016.59
7.4.60.0100.00716.62
7.4.50.0040.00016.41
7.4.40.0030.00922.77
7.4.30.0060.00916.76
7.4.10.0170.00314.90
7.4.00.0080.01014.94
7.3.330.0030.00313.42
7.3.320.0050.00013.28
7.3.310.0030.00316.42
7.3.300.0000.00716.45
7.3.290.0060.00816.40
7.3.280.0080.00916.41
7.3.270.0170.00017.40
7.3.260.0080.01516.55
7.3.250.0140.00516.60
7.3.240.0090.01216.36
7.3.230.0070.01016.56
7.3.210.0100.00716.43
7.3.200.0150.00819.39
7.3.190.0120.01216.52
7.3.180.0030.01316.41
7.3.170.0100.00616.45
7.3.160.0080.00816.49
7.3.130.0070.01114.73
7.3.120.0050.01114.75
7.3.110.0000.01515.05
7.3.100.0080.00614.93
7.3.90.0000.00914.91
7.3.80.0070.00415.13
7.3.70.0090.00614.93
7.3.60.0100.00014.61
7.3.50.0030.00615.04
7.3.40.0000.00914.89
7.3.30.0070.00414.95
7.3.20.0000.01516.86
7.3.10.0060.00816.73
7.3.00.0020.01216.58
7.2.330.0070.01016.77
7.2.320.0050.01416.88
7.2.310.0100.00716.83
7.2.300.0030.01316.68
7.2.290.0090.00616.86
7.2.260.0130.00714.92
7.2.250.0070.01314.89
7.2.240.0070.00715.23
7.2.230.0110.00415.30
7.2.220.0090.00915.25
7.2.210.0070.01115.36
7.2.200.0060.00915.17
7.2.190.0030.00614.88
7.2.180.0030.01015.21
7.2.170.0070.01114.86
7.2.160.0040.00815.04
7.2.150.0000.01616.97
7.2.140.0100.00316.93
7.2.130.0050.00916.83
7.2.120.0080.00616.91
7.2.110.0030.01016.89
7.2.100.0070.00416.92
7.2.90.0070.00916.92
7.2.80.0020.01017.11
7.2.70.0060.00716.86
7.2.60.0050.00516.73
7.2.50.0020.01316.96
7.2.40.0050.00616.83
7.2.30.0050.01116.88
7.2.20.0050.00916.96
7.2.10.0050.01016.92
7.2.00.0080.00917.68
7.1.330.0000.01515.98
7.1.320.0090.00615.96
7.1.310.0120.00315.94
7.1.300.0040.00415.78
7.1.290.0040.01115.47
7.1.280.0070.00715.77
7.1.270.0070.00715.51
7.1.260.0080.00415.66
7.1.250.0040.01115.66
7.1.240.0090.00315.82
7.1.230.0060.00615.61
7.1.220.0040.01115.72
7.1.210.0050.00515.92
7.1.200.0060.00815.81
7.1.190.0030.01015.80
7.1.180.0080.00415.90
7.1.170.0080.00415.87
7.1.160.0090.00315.63
7.1.150.0100.00315.73
7.1.140.0120.00315.74
7.1.130.0080.00816.00
7.1.120.0100.00315.63
7.1.110.0000.01315.92
7.1.100.0030.00717.05
7.1.90.0030.01015.81
7.1.80.0100.00315.85
7.1.70.0020.01016.60
7.1.60.0090.00917.61
7.1.50.0070.01216.43
7.1.40.0040.01115.86
7.1.30.0130.00315.85
7.1.20.0000.01316.00
7.1.10.0000.01615.81
7.1.00.0020.04419.07
7.0.330.0030.01315.30
7.0.320.0040.00815.10
7.0.310.0040.00415.46
7.0.300.0030.00715.22
7.0.290.0040.01115.48
7.0.280.0030.00615.43
7.0.270.0070.00415.39
7.0.260.0030.01015.41
7.0.250.0050.00515.41
7.0.240.0080.00415.35
7.0.230.0000.01315.39
7.0.220.0040.00415.14
7.0.210.0090.00015.53
7.0.200.0110.00216.19
7.0.190.0030.00715.46
7.0.180.0040.00815.49
7.0.170.0110.00315.46
7.0.160.0040.01115.26
7.0.150.0040.01115.42
7.0.140.0040.04018.75
7.0.130.0070.00715.50
7.0.120.0070.00715.55
7.0.110.0040.00715.53
7.0.100.0030.02717.78
7.0.90.0070.04817.73
7.0.80.0080.02317.76
7.0.70.0170.03717.53
7.0.60.0050.02717.74
7.0.50.0120.02518.05
7.0.40.0030.02716.82
7.0.30.0100.04216.80
7.0.20.0070.03016.89
7.0.10.0070.02516.88
7.0.00.0110.04116.80
5.6.400.0070.00714.64
5.6.390.0090.00614.45
5.6.380.0090.00614.16
5.6.370.0000.00814.66
5.6.360.0060.00314.40
5.6.350.0060.00314.40
5.6.340.0070.00314.68
5.6.330.0000.01314.46
5.6.320.0030.01014.34
5.6.310.0000.01014.07
5.6.300.0080.01114.57
5.6.290.0030.01114.62
5.6.280.0120.03517.67
5.6.270.0050.00514.20
5.6.260.0080.00814.30
5.6.250.0080.04217.66
5.6.240.0050.04217.61
5.6.230.0070.02117.30
5.6.220.0030.03717.51
5.6.210.0060.03117.39
5.6.200.0080.03617.58
5.6.190.0070.02617.83
5.6.180.0080.04417.83
5.6.170.0060.04217.91
5.6.160.0100.04417.64
5.6.150.0030.02717.64
5.6.140.0080.03217.55
5.6.130.0070.04317.69
5.6.120.0100.04517.95
5.6.110.0040.05017.68
5.6.100.0050.04117.71
5.6.90.0070.04417.88
5.6.80.0030.03017.41
5.6.70.0050.03917.35
5.6.60.0070.04517.31
5.6.50.0060.03817.44
5.6.40.0050.02417.53
5.6.30.0100.03617.29
5.6.20.0090.02317.48
5.6.10.0060.02917.46
5.6.00.0070.04017.37
5.5.380.0060.02617.37
5.5.370.0050.04517.45
5.5.360.0050.04517.55
5.5.350.0020.02817.36
5.5.340.0080.04317.33
5.5.330.0070.04417.61
5.5.320.0060.03017.64
5.5.310.0070.03517.58
5.5.300.0020.03017.72
5.5.290.0050.02717.40
5.5.280.0070.04417.72
5.5.270.0030.03117.75
5.5.260.0100.02617.57
5.5.250.0080.04217.49
5.5.240.0020.04317.28
5.5.230.0100.03517.39
5.5.220.0050.04217.27
5.5.210.0030.02417.20
5.5.200.0030.03017.04
5.5.190.0070.04117.34
5.5.180.0130.04217.12
5.5.170.0000.00914.10
5.5.160.0060.03517.22
5.5.150.0070.04317.13
5.5.140.0050.02517.33
5.5.130.0100.02517.28
5.5.120.0070.04317.23
5.5.110.0070.03917.22
5.5.100.0070.04217.33
5.5.90.0100.04017.26
5.5.80.0100.03817.04
5.5.70.0060.03717.20
5.5.60.0080.03817.23
5.5.50.0120.03217.08
5.5.40.0060.03817.12
5.5.30.0020.02917.04
5.5.20.0060.04317.25
5.5.10.0060.04517.19
5.5.00.0070.03717.19
5.4.450.0070.04315.62
5.4.440.0050.04215.63
5.4.430.0030.04515.49
5.4.420.0030.04215.49
5.4.410.0030.02715.52
5.4.400.0050.04215.52
5.4.390.0100.03015.36
5.4.380.0080.03915.33
5.4.370.0000.04415.53
5.4.360.0120.03715.49
5.4.350.0070.03315.36
5.4.340.0080.03315.39
5.4.330.0110.00011.81
5.4.320.0080.02115.43
5.4.310.0050.04115.47
5.4.300.0050.04015.38
5.4.290.0050.03115.51
5.4.280.0110.03915.34
5.4.270.0080.03315.47
5.4.260.0000.02815.34
5.4.250.0030.03815.46
5.4.240.0110.03815.42
5.4.230.0080.04015.45
5.4.220.0060.02315.50
5.4.210.0080.04315.45
5.4.200.0030.04415.46
5.4.190.0050.04115.37
5.4.180.0100.03515.37
5.4.170.0080.03715.42
5.4.160.0100.03515.41
5.4.150.0070.03715.48
5.4.140.0080.03314.10
5.4.130.0100.03614.16
5.4.120.0050.03814.14
5.4.110.0080.02314.15
5.4.100.0020.04414.17
5.4.90.0070.03714.10
5.4.80.0100.03514.14
5.4.70.0020.04214.19
5.4.60.0060.03914.06
5.4.50.0080.03814.14
5.4.40.0060.04014.12
5.4.30.0030.03414.14
5.4.20.0030.02014.12
5.4.10.0020.04214.11
5.4.00.0120.01313.84
5.3.290.0070.02513.31
5.3.280.0000.02913.22
5.3.270.0050.02413.25
5.3.260.0050.04213.28
5.3.250.0070.03813.29
5.3.240.0050.03713.18
5.3.230.0050.03813.24
5.3.220.0070.04213.21
5.3.210.0050.03913.24
5.3.200.0070.03013.22
5.3.190.0050.03413.22
5.3.180.0030.04113.16
5.3.170.0050.04013.20
5.3.160.0050.02813.19
5.3.150.0020.04013.19
5.3.140.0110.02813.18
5.3.130.0020.03013.19
5.3.120.0030.04013.24
5.3.110.0020.03313.26
5.3.100.0000.04612.89
5.3.90.0110.03212.95
5.3.80.0030.03812.91
5.3.70.0020.04212.93
5.3.60.0030.04012.94
5.3.50.0050.03812.92
5.3.40.0080.03412.86
5.3.30.0020.02412.83
5.3.20.0070.03512.73
5.3.10.0090.02312.74
5.3.00.0050.04012.76
5.2.170.0000.03712.31
5.2.160.0070.06312.31
5.2.150.0070.06712.31
5.2.140.0030.06712.31
5.2.130.0070.06012.31
5.2.120.0100.05712.31
5.2.110.0030.04312.31
5.2.100.0030.03312.31
5.2.90.0130.04012.31
5.2.80.0030.06312.31
5.2.70.0100.06012.31
5.2.60.0070.05012.31
5.2.50.0030.04312.31
5.2.40.0030.06312.31
5.2.30.0030.06312.31
5.2.20.0000.03312.31
5.2.10.0030.06312.31
5.2.00.0070.05312.31
5.1.60.0030.05312.31
5.1.50.0000.05312.31
5.1.40.0100.04312.31
5.1.30.0000.06012.31
5.1.20.0030.06012.31
5.1.10.0030.03012.31
5.1.00.0070.03712.31
5.0.50.0030.04712.31
5.0.40.0030.03712.31
5.0.30.0030.06712.31
5.0.20.0030.02012.31
5.0.10.0100.02012.31
5.0.00.0070.06012.31
4.4.90.0030.02012.31
4.4.80.0030.03312.31
4.4.70.0030.03712.31
4.4.60.0030.03312.31
4.4.50.0070.03312.31
4.4.40.0030.02012.31
4.4.30.0030.01712.31
4.4.20.0000.02012.31
4.4.10.0030.02012.31
4.4.00.0000.03012.31
4.3.110.0030.03012.31
4.3.100.0070.01312.31
4.3.90.0000.02712.31
4.3.80.0000.05312.31
4.3.70.0000.02012.31
4.3.60.0030.03012.31
4.3.50.0000.02012.31
4.3.40.0000.03012.31
4.3.30.0070.01312.31
4.3.20.0000.03012.31
4.3.10.0030.01712.31
4.3.00.0000.02012.31

preferences:
43.23 ms | 401 KiB | 5 Q