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)); $signBit = (bool) ($longs[0] & 0x80000000); $isSigned = (bool) ($flags & INT_SIGNED); if (is32Bit()) { if ($isSigned) { } else { if ($longs[0] & 0x80000000) { $longs[0] = (($longs[0] & 0x7FFFFFFF) * 2) + ~$longs[0] + 1; } if ($longs[1] & 0x80000000) { $longs[1] = (($longs[1] & 0x7FFFFFFF) * 2) + ~$longs[1] + 1; } $result = ($longs[0] * pow(2, 32)) + $longs[1]; } } else { $result = ($longs[0] << 32) | $longs[1]; if ($signBit && !$isSigned) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } return $result; } printf('%f', unpack_int64("\x00\x00\x00\x07\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.0110.00316.75
8.3.50.0080.00722.00
8.3.40.0110.00718.79
8.3.30.0040.01118.94
8.3.20.0080.00019.96
8.3.10.0080.00023.40
8.3.00.0060.00919.38
8.2.180.0060.00918.41
8.2.170.0000.01522.96
8.2.160.0070.00720.38
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0150.00426.16
8.2.120.0040.00422.08
8.2.110.0000.00822.29
8.2.100.0000.01117.78
8.2.90.0040.00419.27
8.2.80.0040.00418.05
8.2.70.0060.00317.63
8.2.60.0040.00418.04
8.2.50.0040.00818.07
8.2.40.0030.00618.03
8.2.30.0050.00218.25
8.2.20.0050.00517.77
8.2.10.0000.00818.07
8.2.00.0040.00417.83
8.1.280.0170.00325.92
8.1.270.0060.00323.92
8.1.260.0080.00026.35
8.1.250.0000.00928.09
8.1.240.0060.00323.85
8.1.230.0070.00419.10
8.1.220.0030.00617.79
8.1.210.0060.00318.77
8.1.200.0060.00317.23
8.1.190.0000.00817.43
8.1.180.0080.00018.10
8.1.170.0030.00618.59
8.1.160.0000.00721.92
8.1.150.0020.00518.66
8.1.140.0040.00417.46
8.1.130.0030.00317.86
8.1.120.0030.00517.49
8.1.110.0080.00017.52
8.1.100.0000.00817.48
8.1.90.0040.00417.38
8.1.80.0000.00717.50
8.1.70.0000.00717.40
8.1.60.0090.00017.63
8.1.50.0040.00417.61
8.1.40.0030.00517.59
8.1.30.0050.00317.61
8.1.20.0080.00017.62
8.1.10.0040.00417.66
8.1.00.0040.00417.61
8.0.300.0040.00418.77
8.0.290.0000.00717.16
8.0.280.0000.00718.41
8.0.270.0030.00317.29
8.0.260.0030.00316.72
8.0.250.0030.00316.99
8.0.240.0070.00016.94
8.0.230.0070.00016.93
8.0.220.0070.00016.89
8.0.210.0070.00016.79
8.0.200.0030.00316.89
8.0.190.0070.00016.94
8.0.180.0040.00416.95
8.0.170.0080.00016.84
8.0.160.0040.00416.88
8.0.150.0000.00716.88
8.0.140.0040.00416.89
8.0.130.0060.00013.34
8.0.120.0050.00316.91
8.0.110.0040.00416.83
8.0.100.0040.00416.98
8.0.90.0080.00017.04
8.0.80.0120.00416.87
8.0.70.0000.00816.79
8.0.60.0000.00816.77
8.0.50.0000.00716.91
8.0.30.0060.01316.94
8.0.20.0130.00617.45
8.0.10.0050.00216.91
8.0.00.0140.00416.79
7.4.330.0050.00015.00
7.4.320.0000.00616.64
7.4.300.0030.00316.58
7.4.290.0050.00216.52
7.4.280.0030.00316.43
7.4.270.0070.00016.59
7.4.260.0000.00716.62
7.4.250.0040.00416.52
7.4.240.0020.00516.65
7.4.230.0030.00316.34
7.4.220.0070.01116.68
7.4.210.0080.00716.56
7.4.200.0030.00316.73
7.4.190.0000.00716.70
7.4.160.0100.00616.55
7.4.150.0120.01317.40
7.4.140.0070.01117.86
7.4.130.0120.00516.57
7.4.120.0070.01016.59
7.4.110.0070.01016.52
7.4.100.0090.01316.78
7.4.90.0140.00416.48
7.4.80.0100.01019.39
7.4.70.0130.00316.53
7.4.60.0120.00616.50
7.4.50.0030.00516.38
7.4.40.0080.00322.77
7.4.30.0040.01116.36
7.4.10.0110.00714.98
7.4.00.0040.01414.90
7.3.330.0030.00313.46
7.3.320.0000.00513.35
7.3.310.0040.00216.21
7.3.300.0040.00416.33
7.3.290.0120.00616.44
7.3.280.0060.01216.35
7.3.270.0130.00317.40
7.3.260.0140.00316.74
7.3.250.0060.01116.57
7.3.240.0030.01616.38
7.3.230.0080.01216.44
7.3.210.0110.00616.41
7.3.200.0140.00319.39
7.3.190.0090.00916.42
7.3.180.0160.00016.44
7.3.170.0140.00416.61
7.3.160.0080.00816.60
7.3.130.0040.01515.01
7.3.120.0130.00314.81
7.3.110.0120.00614.91
7.3.100.0090.00314.80
7.3.90.0060.00914.65
7.3.80.0040.00414.83
7.3.70.0080.00614.84
7.3.60.0080.00514.97
7.3.50.0100.00614.74
7.3.40.0000.01014.91
7.3.30.0000.01414.88
7.3.20.0060.00316.41
7.3.10.0050.00816.84
7.3.00.0070.01116.53
7.2.330.0130.00616.80
7.2.320.0130.00316.64
7.2.310.0070.01016.64
7.2.300.0030.01416.48
7.2.290.0000.01716.64
7.2.260.0110.00615.02
7.2.250.0050.00815.06
7.2.240.0030.01014.88
7.2.230.0060.00615.27
7.2.220.0000.01614.95
7.2.210.0080.00415.35
7.2.200.0030.01215.02
7.2.190.0060.00915.15
7.2.180.0030.01414.78
7.2.170.0080.00815.11
7.2.160.0100.00314.79
7.2.150.0120.00017.02
7.2.140.0070.01117.03
7.2.130.0080.00417.03
7.2.120.0090.00316.69
7.2.110.0040.01117.06
7.2.100.0080.00816.89
7.2.90.0030.01116.96
7.2.80.0100.00316.93
7.2.70.0030.00916.95
7.2.60.0060.00616.98
7.2.50.0040.00416.88
7.2.40.0120.00316.88
7.2.30.0030.01016.89
7.2.20.0030.01017.09
7.2.10.0060.00617.12
7.2.00.0090.00518.20
7.1.330.0100.00315.71
7.1.320.0100.00315.98
7.1.310.0030.01115.90
7.1.300.0070.00715.86
7.1.290.0030.00615.82
7.1.280.0000.01315.86
7.1.270.0030.00615.88
7.1.260.0040.01415.61
7.1.250.0030.00915.81
7.1.240.0090.00315.59
7.1.230.0080.00415.90
7.1.220.0100.00315.63
7.1.210.0070.00715.92
7.1.200.0040.00415.84
7.1.190.0030.01015.97
7.1.180.0040.01115.80
7.1.170.0050.00515.83
7.1.160.0030.00715.90
7.1.150.0000.01015.48
7.1.140.0110.00415.93
7.1.130.0070.00715.94
7.1.120.0100.00015.92
7.1.110.0100.00715.97
7.1.100.0080.00516.82
7.1.90.0050.00515.82
7.1.80.0040.00815.76
7.1.70.0060.00516.58
7.1.60.0080.00717.48
7.1.50.0100.01025.21
7.1.40.0080.00415.86
7.1.30.0100.00315.61
7.1.20.0060.00615.71
7.1.10.0030.01015.79
7.1.00.0040.04018.96
7.0.330.0060.00615.49
7.0.320.0100.00015.43
7.0.310.0100.00615.25
7.0.300.0080.00415.41
7.0.290.0030.01315.54
7.0.280.0060.00315.64
7.0.270.0100.00615.61
7.0.260.0030.01415.44
7.0.250.0030.00815.59
7.0.240.0060.00615.39
7.0.230.0040.00415.32
7.0.220.0030.00715.36
7.0.210.0070.00715.55
7.0.200.0020.00616.16
7.0.190.0050.00515.54
7.0.180.0030.00615.35
7.0.170.0070.00715.52
7.0.160.0000.01515.18
7.0.150.0070.00715.51
7.0.140.0040.04018.77
7.0.130.0040.01115.13
7.0.120.0030.02718.76
7.0.110.0030.02818.57
7.0.100.0050.02418.78
7.0.90.0100.01818.75
7.0.80.0030.02918.82
7.0.70.0050.03318.79
7.0.60.0050.02018.67
7.0.50.0030.02618.78
7.0.40.0020.02916.85
7.0.30.0020.02716.74
7.0.20.0020.02516.83
7.0.10.0080.03616.73
7.0.00.0030.04516.66
5.6.400.0040.01214.73
5.6.390.0040.00714.55
5.6.380.0060.00314.11
5.6.370.0030.00714.66
5.6.360.0060.00614.27
5.6.350.0030.00614.63
5.6.340.0070.00414.54
5.6.330.0080.00314.40
5.6.320.0040.00814.68
5.6.310.0060.00914.07
5.6.300.0050.00314.75
5.6.290.0000.01414.45
5.6.280.0050.04017.67
5.6.270.0070.03817.75
5.6.260.0050.04317.62
5.6.250.0030.03917.71
5.6.240.0050.03317.53
5.6.230.0030.03317.83
5.6.220.0020.04517.51
5.6.210.0080.02317.79
5.6.200.0070.02417.71
5.6.190.0100.01817.74
5.6.180.0000.02717.72
5.6.170.0000.02817.53
5.6.160.0100.02017.77
5.6.150.0050.02217.70
5.6.140.0100.04317.71
5.6.130.0040.02817.63
5.6.120.0030.02317.61
5.6.110.0100.03817.68
5.6.100.0020.02717.78
5.6.90.0020.03817.54
5.6.80.0020.03217.45
5.6.70.0040.02317.25
5.6.60.0020.03117.24
5.6.50.0020.02617.16
5.6.40.0040.02517.25
5.6.30.0040.04917.39
5.6.20.0050.02517.28
5.6.10.0020.02817.35
5.6.00.0030.02017.34
5.5.380.0070.02415.98
5.5.370.0070.02315.94
5.5.360.0070.04215.76
5.5.350.0050.02715.98
5.5.340.0030.04316.41
5.5.330.0050.03116.27
5.5.320.0070.02415.98
5.5.310.0050.02516.21
5.5.300.0050.02716.20
5.5.290.0020.03716.15
5.5.280.0040.02716.28
5.5.270.0050.03216.25
5.5.260.0020.05016.18
5.5.250.0080.05016.16
5.5.240.0020.02515.88
5.5.230.0040.02215.86
5.5.220.0070.03215.68
5.5.210.0050.03815.90
5.5.200.0040.04215.82
5.5.190.0050.03315.87
5.5.180.0030.02315.80
5.5.170.0000.00814.19
5.5.160.0020.02215.83
5.5.150.0050.01815.78
5.5.140.0060.01815.90
5.5.130.0050.01615.82
5.5.120.0070.01815.86
5.5.110.0040.01815.64
5.5.100.0000.02415.81
5.5.90.0020.02015.84
5.5.80.0030.02115.66
5.5.70.0030.02315.83
5.5.60.0040.01915.79
5.5.50.0030.01715.84
5.5.40.0050.02015.91
5.5.30.0070.01515.61
5.5.20.0030.01915.75
5.5.10.0010.02015.83
5.5.00.0050.02015.73
5.4.450.0080.04215.72
5.4.440.0050.02515.76
5.4.430.0020.04515.68
5.4.420.0030.03615.68
5.4.410.0050.03615.63
5.4.400.0070.02315.60
5.4.390.0020.02815.51
5.4.380.0090.03715.59
5.4.370.0050.02715.50
5.4.360.0020.02515.51
5.4.350.0070.02215.60
5.4.340.0080.01715.49
5.4.330.0030.00612.08
5.4.320.0060.01815.52
5.4.310.0030.02115.58
5.4.300.0030.02015.60
5.4.290.0030.02015.60
5.4.280.0020.01815.51
5.4.270.0010.01815.49
5.4.260.0050.01815.59
5.4.250.0020.02115.50
5.4.240.0030.01615.51
5.4.230.0020.01615.56
5.4.220.0030.01915.57
5.4.210.0010.01915.53
5.4.200.0020.01915.53
5.4.190.0050.01715.57
5.4.180.0020.02115.49
5.4.170.0020.02215.52
5.4.160.0030.02015.50
5.4.150.0100.01515.52
5.4.140.0000.02414.21
5.4.130.0040.01614.27
5.4.120.0000.01914.18
5.4.110.0010.02114.20
5.4.100.0060.01514.40
5.4.90.0020.01814.28
5.4.80.0030.01814.30
5.4.70.0010.01914.22
5.4.60.0000.02414.28
5.4.50.0080.01514.25
5.4.40.0030.01814.14
5.4.30.0020.01914.21
5.4.20.0060.01514.20
5.4.10.0050.01714.20
5.4.00.0030.02013.95
5.3.290.0020.02513.44
5.3.280.0040.01613.36
5.3.270.0060.01813.29
5.3.260.0030.01913.47
5.3.250.0020.01813.36
5.3.240.0020.01813.39
5.3.230.0000.02013.35
5.3.220.0020.01913.26
5.3.210.0020.01913.34
5.3.200.0030.02013.26
5.3.190.0000.02113.32
5.3.180.0020.01913.26
5.3.170.0050.01513.34
5.3.160.0000.02013.32
5.3.150.0060.01813.34
5.3.140.0040.01613.40
5.3.130.0010.03113.37
5.3.120.0040.03613.32
5.3.110.0030.02013.44
5.3.100.0070.01813.14
5.3.90.0010.01713.13
5.3.80.0040.02113.04
5.3.70.0040.02313.06
5.3.60.0030.02013.12
5.3.50.0040.01813.07
5.3.40.0080.02113.02
5.3.30.0050.03512.98
5.3.20.0050.01512.90
5.3.10.0050.01712.88
5.3.00.0050.03112.88
5.2.170.0000.03011.17
5.2.160.0000.04711.24
5.2.150.0000.03011.25
5.2.140.0030.02011.17
5.2.130.0000.04011.21
5.2.120.0030.03011.11
5.2.110.0000.03311.21
5.2.100.0000.05711.09
5.2.90.0030.04310.98
5.2.80.0030.03011.26
5.2.70.0000.03711.11
5.2.60.0030.05711.07
5.2.50.0000.03311.18
5.2.40.0030.03010.99
5.2.30.0000.05710.95
5.2.20.0000.03010.97
5.2.10.0030.02710.90
5.2.00.0030.02710.83
5.1.60.0000.03010.15
5.1.50.0030.02010.00
5.1.40.0000.0479.98
5.1.30.0000.02710.42
5.1.20.0000.02710.35
5.1.10.0000.03010.13
5.1.00.0000.02710.22
5.0.50.0000.0209.66
5.0.40.0000.0209.66
5.0.30.0000.0309.66
5.0.20.0000.0209.66
5.0.10.0030.0179.66
5.0.00.0030.0279.66
4.4.90.0030.0139.66
4.4.80.0030.0139.66
4.4.70.0000.0179.66
4.4.60.0000.0139.66
4.4.50.0000.0179.66
4.4.40.0030.0179.66
4.4.30.0000.0139.66
4.4.20.0000.0379.66
4.4.10.0000.0339.66
4.4.00.0000.0239.66
4.3.110.0030.0109.66
4.3.100.0000.0179.66
4.3.90.0000.0139.66
4.3.80.0000.0239.66
4.3.70.0030.0139.66
4.3.60.0030.0109.66
4.3.50.0000.0209.66
4.3.40.0000.0239.66
4.3.30.0000.0139.66
4.3.20.0000.0179.66
4.3.10.0000.0239.66
4.3.00.0000.0139.66

preferences:
43.1 ms | 401 KiB | 5 Q