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("\x80\x00\x00\x0F\xFF\xFF\xFF\xFF", INT_SIGNED));

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.0070.01118.30
8.3.50.0120.00717.34
8.3.40.0130.00418.84
8.3.30.0110.00418.50
8.3.20.0040.00418.60
8.3.10.0080.00018.75
8.3.00.0090.00019.13
8.2.180.0140.00716.63
8.2.170.0040.01622.96
8.2.160.0110.00718.83
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00420.96
8.2.110.0110.00020.37
8.2.100.0040.00717.72
8.2.90.0000.00817.95
8.2.80.0050.00317.97
8.2.70.0000.00817.75
8.2.60.0000.00817.93
8.2.50.0030.00518.07
8.2.40.0040.00418.22
8.2.30.0050.00218.13
8.2.20.0040.00417.73
8.2.10.0070.00017.75
8.2.00.0000.00717.64
8.1.280.0170.00325.92
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0060.00320.79
8.1.230.0070.00420.98
8.1.220.0000.00917.74
8.1.210.0040.00418.87
8.1.200.0040.00417.35
8.1.190.0050.00317.50
8.1.180.0030.00518.10
8.1.170.0060.00318.64
8.1.160.0000.00718.93
8.1.150.0050.00318.69
8.1.140.0000.00717.47
8.1.130.0000.00717.91
8.1.120.0000.00717.47
8.1.110.0040.00417.41
8.1.100.0040.00417.45
8.1.90.0000.00717.49
8.1.80.0000.00717.49
8.1.70.0030.00317.47
8.1.60.0000.00717.60
8.1.50.0040.00417.50
8.1.40.0080.00017.55
8.1.30.0040.00417.67
8.1.20.0050.00217.56
8.1.10.0040.00417.64
8.1.00.0040.00417.45
8.0.300.0050.00319.90
8.0.290.0050.00216.75
8.0.280.0040.00418.49
8.0.270.0000.00717.27
8.0.260.0000.00816.84
8.0.250.0040.00416.88
8.0.240.0040.00416.93
8.0.230.0030.00316.99
8.0.220.0070.00016.81
8.0.210.0000.00716.86
8.0.200.0030.00316.94
8.0.190.0020.00516.87
8.0.180.0070.00416.84
8.0.170.0030.00616.88
8.0.160.0000.00716.87
8.0.150.0000.00816.85
8.0.140.0030.00616.74
8.0.130.0030.00313.31
8.0.120.0060.00316.88
8.0.110.0000.00716.77
8.0.100.0070.00016.77
8.0.90.0000.00716.79
8.0.80.0080.01216.85
8.0.70.0030.00516.86
8.0.60.0000.00716.95
8.0.50.0040.00416.77
8.0.30.0060.01317.32
8.0.20.0150.00517.15
8.0.10.0070.00016.99
8.0.00.0100.00916.91
7.4.330.0070.00013.02
7.4.320.0060.00016.64
7.4.300.0060.00316.63
7.4.290.0030.00316.64
7.4.280.0030.00616.66
7.4.270.0030.00316.66
7.4.260.0060.00013.40
7.4.250.0000.00716.55
7.4.240.0030.00416.53
7.4.230.0030.00316.63
7.4.220.0110.01116.61
7.4.210.0070.01416.58
7.4.200.0000.00716.67
7.4.190.0000.00716.68
7.4.160.0110.01116.68
7.4.150.0000.01616.34
7.4.140.0070.01716.62
7.4.130.0070.01016.38
7.4.120.0060.00916.43
7.4.110.0110.01116.72
7.4.100.0100.00616.50
7.4.90.0070.01416.56
7.4.80.0150.00619.39
7.4.70.0180.00016.55
7.4.60.0030.01416.52
7.4.50.0030.00616.47
7.4.40.0090.00616.50
7.4.30.0090.00916.45
7.4.10.0070.01015.23
7.4.00.0060.01115.08
7.3.330.0030.00313.34
7.3.320.0030.00313.26
7.3.310.0030.00316.27
7.3.300.0030.00316.36
7.3.290.0090.00616.34
7.3.280.0080.01016.39
7.3.270.0080.00916.54
7.3.260.0110.00816.66
7.3.250.0170.00516.59
7.3.240.0120.01216.49
7.3.230.0080.00816.61
7.3.210.0090.00916.41
7.3.200.0060.01216.45
7.3.190.0080.01416.56
7.3.180.0040.01216.43
7.3.170.0100.00716.66
7.3.160.0080.00816.50
7.3.130.0040.01415.09
7.3.120.0070.00914.98
7.3.110.0070.01014.97
7.3.100.0040.01214.95
7.3.90.0030.01414.92
7.3.80.0060.00314.89
7.3.70.0030.01014.62
7.3.60.0030.00614.73
7.3.50.0060.00914.70
7.3.40.0040.00714.77
7.3.30.0040.00814.79
7.3.20.0040.01116.71
7.3.10.0030.00716.47
7.3.00.0050.01016.52
7.2.330.0150.00416.56
7.2.320.0120.00616.69
7.2.310.0220.01116.44
7.2.300.0030.01416.46
7.2.290.0070.01316.55
7.2.260.0070.00615.18
7.2.250.0030.01615.31
7.2.240.0030.01115.28
7.2.230.0040.00914.77
7.2.220.0000.01615.17
7.2.210.0000.01015.08
7.2.200.0060.00315.23
7.2.190.0040.00815.17
7.2.180.0030.01015.04
7.2.170.0090.00015.16
7.2.160.0000.00914.90
7.2.150.0090.00617.00
7.2.140.0000.01416.97
7.2.130.0070.00316.70
7.2.120.0070.01016.60
7.2.110.0080.00516.79
7.2.100.0060.00916.90
7.2.90.0080.00516.61
7.2.80.0030.01516.63
7.2.70.0040.01016.91
7.2.60.0020.00916.76
7.2.50.0040.01316.88
7.2.40.0130.00216.88
7.2.30.0110.00616.67
7.2.20.0030.01116.80
7.2.10.0070.00516.91
7.2.00.0050.00917.53
7.1.330.0090.00615.82
7.1.320.0000.01715.97
7.1.310.0060.00616.00
7.1.300.0060.00315.66
7.1.290.0040.00415.76
7.1.280.0040.00815.99
7.1.270.0070.00715.86
7.1.260.0070.00715.77
7.1.250.0030.00815.77
7.1.240.0030.01016.03
7.1.230.0030.00515.75
7.1.220.0070.00315.58
7.1.210.0070.01015.82
7.1.200.0070.00115.71
7.1.190.0030.01015.88
7.1.180.0030.00915.79
7.1.170.0060.00915.74
7.1.160.0030.01315.82
7.1.150.0000.01215.93
7.1.140.0130.00015.98
7.1.130.0080.00415.96
7.1.120.0100.00315.86
7.1.110.0110.00015.92
7.1.100.0040.00716.88
7.1.90.0000.01415.90
7.1.80.0080.00815.48
7.1.70.0020.00916.45
7.1.60.0080.00817.48
7.1.50.0080.01016.40
7.1.40.0090.00615.84
7.1.30.0000.01215.53
7.1.20.0080.00415.46
7.1.10.0000.01115.77
7.1.00.0020.02518.99
7.0.330.0000.00915.38
7.0.320.0090.00315.21
7.0.310.0080.00315.44
7.0.300.0030.01315.52
7.0.290.0060.00615.07
7.0.280.0070.00415.22
7.0.270.0070.00415.64
7.0.260.0000.01415.42
7.0.250.0030.00515.37
7.0.240.0030.01015.52
7.0.230.0000.00915.24
7.0.220.0030.01015.21
7.0.210.0060.00615.36
7.0.200.0060.00616.14
7.0.190.0030.01215.34
7.0.180.0060.00915.34
7.0.170.0070.01015.39
7.0.160.0060.00315.49
7.0.150.0030.00915.43
7.0.140.0060.03818.80
7.0.130.0100.00715.32
7.0.120.0030.04318.71
7.0.110.0040.01115.62
7.0.100.0000.00915.57
7.0.90.0130.00015.46
7.0.80.0040.00715.24
7.0.70.0050.00315.43
7.0.60.0080.03817.77
7.0.50.0070.04416.71
7.0.40.0100.02816.84
7.0.30.0300.03816.76
7.0.20.0180.04016.69
7.0.10.0090.04516.81
7.0.00.0020.03016.83
5.6.400.0080.00014.46
5.6.390.0070.00714.70
5.6.380.0090.00314.43
5.6.370.0070.01014.44
5.6.360.0080.00314.54
5.6.350.0070.00714.39
5.6.340.0050.00314.75
5.6.330.0070.00714.67
5.6.320.0000.01414.76
5.6.310.0090.00314.73
5.6.300.0070.00714.62
5.6.290.0000.01414.38
5.6.280.0130.03317.67
5.6.270.0070.01014.36
5.6.260.0100.00314.61
5.6.250.0080.00414.39
5.6.240.0070.00714.54
5.6.230.0030.01314.59
5.6.220.0030.00614.70
5.6.210.0070.03717.40
5.6.200.0050.03616.32
5.6.190.0160.04017.49
5.6.180.1990.02217.63
5.6.170.0190.02717.44
5.6.160.0080.04317.70
5.6.150.0050.02816.33
5.6.140.0080.03316.38
5.6.130.0080.02716.24
5.6.120.0070.02717.71
5.6.110.0120.02817.76
5.6.100.0100.04717.58
5.6.90.0140.03517.82
5.6.80.0090.02617.35
5.6.70.2130.02217.29
5.6.60.0070.00714.53
5.6.50.0000.01314.62
5.6.40.0070.00714.40
5.6.30.0040.00714.58
5.6.20.0040.00714.41
5.6.10.0030.00614.32
5.6.00.0030.01314.15
5.5.380.0030.01014.45
5.5.370.0070.01114.04
5.5.360.0000.01114.21
5.5.350.0090.04017.30
5.5.340.0060.02616.09
5.5.330.0030.05017.27
5.5.320.1950.02917.43
5.5.310.0230.04017.43
5.5.300.0090.03216.30
5.5.290.0030.03716.17
5.5.280.0050.04917.69
5.5.270.0090.04417.71
5.5.260.0070.04717.55
5.5.250.0100.04317.49
5.5.240.0160.04117.23
5.5.230.0030.01013.96
5.5.220.0000.01514.16
5.5.210.0120.00014.39
5.5.200.0040.00814.26
5.5.190.0060.00614.36
5.5.180.0000.01314.44
5.5.170.0040.00814.55
5.5.160.0030.01014.43
5.5.150.0030.00713.92
5.5.140.0040.01114.23
5.5.130.0060.00614.32
5.5.120.0040.00414.32
5.5.110.0060.00614.45
5.5.100.0160.00014.14
5.5.90.0060.01214.05
5.5.80.0000.01314.32
5.5.70.0030.00814.13
5.5.60.0070.00414.32
5.5.50.0060.00314.34
5.5.40.0030.01014.26
5.5.30.0000.01214.35
5.5.20.0040.00414.35
5.5.10.0030.01013.77
5.5.00.0000.01214.60
5.4.450.0020.03115.16
5.4.440.0080.04315.38
5.4.430.0050.02515.25
5.4.420.0060.01815.15
5.4.410.0060.03514.99
5.4.400.0030.02515.11
5.4.390.0030.04515.12
5.4.380.0070.03114.90
5.4.370.0150.03215.15
5.4.360.0020.04514.92
5.4.350.0200.02015.00
5.4.340.0130.02615.19
5.4.330.0040.00711.17
5.4.320.0070.02915.07
5.4.310.0130.03315.27
5.4.300.0030.03115.24
5.4.290.0080.02315.02
5.4.280.0030.02715.01
5.4.270.0100.03215.07
5.4.260.0010.02815.02
5.4.250.0120.02815.05
5.4.240.0070.03815.26
5.4.230.0060.04015.12
5.4.220.0050.03914.93
5.4.210.0080.02215.20
5.4.200.0050.04215.19
5.4.190.0070.03615.06
5.4.180.0020.04515.18
5.4.170.0070.03015.05
5.4.160.0060.03714.96
5.4.150.0070.04015.07
5.4.140.0090.02613.85
5.4.130.0030.02513.63
5.4.120.0060.02613.83
5.4.110.0050.02213.78
5.4.100.0030.04213.89
5.4.90.0070.03413.72
5.4.80.0000.03513.82
5.4.70.0050.03513.91
5.4.60.0070.02113.61
5.4.50.0060.02313.65
5.4.40.0080.03613.78
5.4.30.0100.03613.72
5.4.20.0070.03813.80
5.4.10.0070.03713.87
5.4.00.0080.03713.57
5.3.290.0050.04112.74
5.3.280.0020.03612.68
5.3.270.0080.04012.67
5.3.260.0100.03812.55
5.3.250.0060.03312.72
5.3.240.0030.04112.41
5.3.230.0030.02612.67
5.3.220.0070.02012.56
5.3.210.0050.03212.54
5.3.200.0050.02412.48
5.3.190.0050.03812.61
5.3.180.0070.02812.59
5.3.170.0100.03512.54
5.3.160.0050.03912.67
5.3.150.0050.02712.69
5.3.140.0040.02912.56
5.3.130.0050.03212.64
5.3.120.0050.03512.60
5.3.110.0080.03812.52
5.3.100.0130.02312.45
5.3.90.0120.03712.21
5.3.80.0080.03012.13
5.3.70.0050.04212.18
5.3.60.0060.03112.27
5.3.50.0070.03812.31
5.3.40.0020.03712.40
5.3.30.0020.04212.27
5.3.20.0030.04112.13
5.3.10.0060.03911.96
5.3.00.0030.04012.05
5.2.170.0030.06711.32
5.2.160.0030.03011.17
5.2.150.0000.04711.12
5.2.140.0000.07011.23
5.2.130.0070.04011.07
5.2.120.0070.05311.09
5.2.110.0070.05711.08
5.2.100.0030.04711.13
5.2.90.0100.05311.07
5.2.80.0030.05011.07
5.2.70.0030.03711.18
5.2.60.0030.04011.04
5.2.50.0130.03711.04
5.2.40.0070.06011.03
5.2.30.0030.06310.96
5.2.20.0030.03310.97
5.2.10.0030.06310.89
5.2.00.0070.03010.81
5.1.60.0070.05310.70
5.1.50.0100.03710.70
5.1.40.0030.03710.70
5.1.30.0000.06010.70
5.1.20.0070.04010.70
5.1.10.0000.03310.70
5.1.00.0030.05710.70
5.0.50.0030.02010.70
5.0.40.0030.04010.70
5.0.30.0070.03710.70
5.0.20.0030.03710.70
5.0.10.0030.02710.70
5.0.00.0130.02710.70
4.4.90.0030.03310.70
4.4.80.0030.01310.70
4.4.70.0000.03010.70
4.4.60.0000.04010.70
4.4.50.0070.02710.70
4.4.40.0030.05310.70
4.4.30.0000.03710.70
4.4.20.0070.02310.70
4.4.10.0000.02010.70
4.4.00.0000.05010.70
4.3.110.0000.03710.70
4.3.100.0030.01710.70
4.3.90.0000.03710.70
4.3.80.0030.04010.70
4.3.70.0030.02710.70
4.3.60.0000.03710.70
4.3.50.0070.02010.70
4.3.40.0100.03010.70
4.3.30.0030.03710.70
4.3.20.0070.02710.70
4.3.10.0000.02710.70
4.3.00.0000.03710.70

preferences:
44.47 ms | 401 KiB | 5 Q