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 = ($longs[0] << 32) | $longs[1]; if ($signBit && !$isSigned) { $result = (($result & 0x7FFFFFFFFFFFFFFF) * 2) + ~$result + 1; } } else { $result = 0; } return $result; } var_dump(unpack_int64("\xFF\xFF\xFF\xFF\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.40.0080.01118.65
8.3.30.0130.00619.04
8.3.20.0080.01120.15
8.3.10.0140.00023.37
8.3.00.0130.00719.13
8.2.170.0070.01122.96
8.2.160.0140.00720.42
8.2.150.0020.00524.18
8.2.140.0100.01024.66
8.2.130.0000.01426.16
8.2.120.0040.00422.11
8.2.110.0000.01022.05
8.2.100.0080.00417.97
8.2.90.0040.00419.30
8.2.80.0090.00018.16
8.2.70.0030.00617.63
8.2.60.0050.00318.03
8.2.50.0030.00518.07
8.2.40.0030.00618.28
8.2.30.0050.00318.12
8.2.20.0050.00217.79
8.2.10.0060.00318.14
8.2.00.0000.00917.66
8.1.270.0120.00323.91
8.1.260.0110.00726.35
8.1.250.0070.01028.09
8.1.240.0030.00623.91
8.1.230.0080.00319.22
8.1.220.0000.00817.74
8.1.210.0080.00018.77
8.1.200.0030.00617.35
8.1.190.0060.00317.40
8.1.180.0040.00418.10
8.1.170.0050.00318.65
8.1.160.0040.00421.95
8.1.150.0000.00718.56
8.1.140.0000.00817.46
8.1.130.0050.00317.80
8.1.120.0000.00817.52
8.1.110.0040.00417.38
8.1.100.0000.00717.44
8.1.90.0070.00317.41
8.1.80.0030.00317.43
8.1.70.0040.00417.43
8.1.60.0080.00017.56
8.1.50.0050.00317.52
8.1.40.0030.00517.56
8.1.30.0000.00817.63
8.1.20.0000.00717.71
8.1.10.0000.00817.57
8.1.00.0050.00317.52
8.0.300.0050.00318.77
8.0.290.0070.00017.18
8.0.280.0050.00218.46
8.0.270.0000.00817.28
8.0.260.0030.00316.93
8.0.250.0000.00716.96
8.0.240.0040.00416.88
8.0.230.0000.00817.01
8.0.220.0070.00016.92
8.0.210.0000.00717.00
8.0.200.0070.00016.86
8.0.190.0040.00416.95
8.0.180.0000.00716.89
8.0.170.0070.00016.84
8.0.160.0070.00016.93
8.0.150.0060.00316.84
8.0.140.0040.00416.77
8.0.130.0050.00013.38
8.0.120.0040.00416.82
8.0.110.0040.00416.77
8.0.100.0000.00816.96
8.0.90.0000.00716.74
8.0.80.0090.00916.82
8.0.70.0080.00016.97
8.0.60.0000.00716.78
8.0.50.0000.00716.96
8.0.30.0090.01116.92
8.0.20.0120.00717.40
8.0.10.0030.00516.90
8.0.00.0100.00916.73
7.4.330.0050.00015.03
7.4.320.0060.00016.42
7.4.300.0060.00016.64
7.4.290.0000.00716.50
7.4.280.0050.00316.46
7.4.270.0040.00416.44
7.4.260.0060.00013.39
7.4.250.0040.00416.60
7.4.240.0030.00416.53
7.4.230.0000.00716.66
7.4.220.0060.01216.46
7.4.210.0050.01016.51
7.4.200.0080.00016.45
7.4.190.0070.00016.42
7.4.160.0120.00316.46
7.4.150.0030.01417.40
7.4.140.0110.01217.86
7.4.130.0130.00316.35
7.4.120.0110.00616.59
7.4.110.0110.00616.43
7.4.100.0090.00916.68
7.4.90.0040.01416.70
7.4.80.0120.00619.39
7.4.70.0030.01616.40
7.4.60.0030.01416.45
7.4.50.0000.00816.73
7.4.40.0070.00722.77
7.4.30.0060.01216.59
7.4.10.0100.01014.94
7.4.00.0060.01114.96
7.3.330.0030.00313.25
7.3.320.0020.00213.14
7.3.310.0050.00316.43
7.3.300.0030.00316.24
7.3.290.0070.01016.35
7.3.280.0090.00916.37
7.3.270.0110.00717.40
7.3.260.0110.00616.57
7.3.250.0080.00916.51
7.3.240.0110.00616.57
7.3.230.0030.01516.39
7.3.210.0120.00416.48
7.3.200.0070.01019.39
7.3.190.0100.01116.45
7.3.180.0120.00416.32
7.3.170.0030.01416.59
7.3.160.0060.00916.43
7.3.130.0030.01614.47
7.3.120.0130.00514.97
7.3.110.0130.00614.53
7.3.100.0060.00314.66
7.3.90.0060.00914.90
7.3.80.0070.00714.99
7.3.70.0100.00714.89
7.3.60.0100.00314.80
7.3.50.0100.00315.02
7.3.40.0000.01014.89
7.3.30.0000.01414.59
7.3.20.0030.00616.49
7.3.10.0100.00316.72
7.3.00.0060.00916.79
7.2.330.0100.01016.71
7.2.320.0100.01316.86
7.2.310.0120.00316.64
7.2.300.0060.01316.60
7.2.290.0090.00816.85
7.2.260.0100.01014.85
7.2.250.0090.00915.13
7.2.240.0030.01214.89
7.2.230.0030.01214.95
7.2.220.0030.00715.03
7.2.210.0060.00814.66
7.2.200.0030.01215.08
7.2.190.0110.00414.72
7.2.180.0030.01014.96
7.2.170.0030.01014.86
7.2.160.0070.01014.93
7.2.150.0000.01316.88
7.2.140.0000.01416.95
7.2.130.0030.01316.80
7.2.120.0000.01416.89
7.2.110.0060.00616.98
7.2.100.0080.00816.67
7.2.90.0030.00917.06
7.2.80.0080.00316.56
7.2.70.0060.00916.73
7.2.60.0000.01216.92
7.2.50.0040.01116.80
7.2.40.0090.00616.89
7.2.30.0030.01216.92
7.2.20.0070.01016.72
7.2.10.0060.01216.82
7.2.00.0050.00818.27
7.1.330.0000.01616.02
7.1.320.0060.00315.91
7.1.310.0120.00615.77
7.1.300.0070.00715.71
7.1.290.0030.01315.73
7.1.280.0040.00715.94
7.1.270.0040.00815.84
7.1.260.0040.01115.82
7.1.250.0040.00815.48
7.1.240.0030.01015.88
7.1.230.0040.00815.56
7.1.220.0000.01415.81
7.1.210.0060.00615.89
7.1.200.0090.00315.71
7.1.190.0120.00315.85
7.1.180.0040.00415.53
7.1.170.0100.00315.74
7.1.160.0030.00915.61
7.1.150.0000.01315.80
7.1.140.0100.00315.59
7.1.130.0120.00415.70
7.1.120.0060.00616.00
7.1.110.0060.00615.67
7.1.100.0040.00717.02
7.1.90.0030.01315.88
7.1.80.0070.00715.69
7.1.70.0050.00616.39
7.1.60.0080.00817.54
7.1.50.0060.01116.37
7.1.40.0060.00615.72
7.1.30.0070.01015.91
7.1.20.0080.00815.87
7.1.10.0060.00615.63
7.1.00.0050.04319.03
7.0.330.0000.01215.28
7.0.320.0060.00615.40
7.0.310.0050.00315.47
7.0.300.0030.01015.42
7.0.290.0030.01315.36
7.0.280.0030.00615.53
7.0.270.0100.00715.41
7.0.260.0070.00315.41
7.0.250.0030.01015.28
7.0.240.0070.00715.49
7.0.230.0090.00615.32
7.0.220.0070.00715.22
7.0.210.0030.00615.46
7.0.200.0020.00816.08
7.0.190.0060.00915.37
7.0.180.0060.00615.41
7.0.170.0030.01415.29
7.0.160.0030.00615.41
7.0.150.0000.01115.41
7.0.140.0020.04018.70
7.0.130.0070.00415.17
7.0.120.0000.01115.51
7.0.110.0070.00415.39
7.0.100.0070.04017.70
7.0.90.0150.02617.65
7.0.80.0080.02317.62
7.0.70.0050.04317.71
7.0.60.0050.02617.63
7.0.50.0130.03317.93
7.0.40.0060.02416.87
7.0.30.0070.04416.82
7.0.20.0040.04316.85
7.0.10.0110.03116.83
7.0.00.0040.03916.73
5.6.400.0060.00914.42
5.6.390.0060.00614.71
5.6.380.0000.01114.36
5.6.370.0030.01014.34
5.6.360.0030.00914.65
5.6.350.0030.00914.00
5.6.340.0030.01014.57
5.6.330.0090.00614.59
5.6.320.0060.00614.38
5.6.310.0070.00714.43
5.6.300.0100.00714.64
5.6.290.0100.00314.58
5.6.280.0070.03917.62
5.6.270.0070.00714.12
5.6.260.0130.00314.09
5.6.250.0080.03717.59
5.6.240.0080.04017.51
5.6.230.0080.04817.74
5.6.220.0100.03817.56
5.6.210.0050.04317.62
5.6.200.0060.04517.66
5.6.190.0030.02817.78
5.6.180.0030.04117.58
5.6.170.0130.02917.59
5.6.160.0030.03017.84
5.6.150.0070.02917.74
5.6.140.0050.02317.81
5.6.130.0030.04717.73
5.6.120.0050.04517.81
5.6.110.0090.04617.70
5.6.100.0100.04017.75
5.6.90.0070.03917.57
5.6.80.0030.04717.44
5.6.70.0030.04217.42
5.6.60.0030.03117.34
5.6.50.0050.02817.34
5.6.40.0070.02517.21
5.6.30.0050.05017.33
5.6.20.0100.04017.24
5.6.10.0050.02817.33
5.6.00.0070.02817.49
5.5.380.0100.04217.37
5.5.370.0100.02717.38
5.5.360.0050.04217.46
5.5.350.0090.02317.38
5.5.340.0110.03617.46
5.5.330.0100.02317.58
5.5.320.0050.04617.37
5.5.310.0070.04717.70
5.5.300.0060.03017.49
5.5.290.0060.04217.46
5.5.280.0140.04517.54
5.5.270.0050.04117.58
5.5.260.0080.04017.66
5.5.250.0090.03417.43
5.5.240.0100.02717.20
5.5.230.0060.04117.29
5.5.220.0080.04017.26
5.5.210.0050.02817.12
5.5.200.0110.03817.27
5.5.190.0050.05017.27
5.5.180.0030.04117.33
5.5.170.0040.00414.30
5.5.160.0080.04017.07
5.5.150.0090.03717.31
5.5.140.0070.04216.98
5.5.130.0030.02717.19
5.5.120.0070.04017.20
5.5.110.0050.04517.26
5.5.100.0110.03717.21
5.5.90.0070.02317.17
5.5.80.0060.03717.27
5.5.70.0070.04217.24
5.5.60.0060.03017.14
5.5.50.0090.03317.27
5.5.40.0050.04617.13
5.5.30.0050.02417.29
5.5.20.0070.04016.94
5.5.10.0050.02317.13
5.5.00.0040.03917.08
5.4.450.0070.03315.27
5.4.440.0040.04115.44
5.4.430.0090.04015.40
5.4.420.0030.04015.34
5.4.410.0080.04315.30
5.4.400.0100.01715.07
5.4.390.0070.03515.15
5.4.380.0020.02815.02
5.4.370.0050.03415.15
5.4.360.0080.03814.95
5.4.350.0080.03815.12
5.4.340.0020.04315.17
5.4.330.0040.00811.44
5.4.320.0070.04515.22
5.4.310.0070.03515.16
5.4.300.0020.02915.02
5.4.290.0120.01714.98
5.4.280.0020.03515.00
5.4.270.0070.02815.12
5.4.260.0030.03015.14
5.4.250.0130.03115.02
5.4.240.0080.03814.98
5.4.230.0050.02614.95
5.4.220.0050.04215.08
5.4.210.0020.04015.18
5.4.200.0130.02015.27
5.4.190.0030.03415.02
5.4.180.0030.03215.23
5.4.170.0100.04114.95
5.4.160.0070.02015.13
5.4.150.0070.02514.96
5.4.140.0030.04013.94
5.4.130.0050.03613.71
5.4.120.0060.02813.72
5.4.110.0120.01713.75
5.4.100.0070.02313.72
5.4.90.0070.02113.75
5.4.80.0050.02913.82
5.4.70.0010.02813.82
5.4.60.0090.02313.81
5.4.50.0030.02313.82
5.4.40.0070.03813.63
5.4.30.0070.03213.79
5.4.20.0010.02613.77
5.4.10.0070.03713.78
5.4.00.0080.03513.51
5.3.290.0050.03512.70
5.3.280.0080.03812.65
5.3.270.0110.03312.65
5.3.260.0050.02312.63
5.3.250.0110.02312.65
5.3.240.0070.02212.62
5.3.230.0050.04112.61
5.3.220.0000.04312.59
5.3.210.0080.03812.46
5.3.200.0080.02812.40
5.3.190.0030.02612.58
5.3.180.0050.04212.72
5.3.170.0050.02712.69
5.3.160.0060.03812.62
5.3.150.0080.02312.54
5.3.140.0090.04012.59
5.3.130.0070.04012.59
5.3.120.0080.04012.59
5.3.110.0030.04312.43
5.3.100.0060.03812.35
5.3.90.0020.04412.14
5.3.80.0080.02012.18
5.3.70.0080.02012.17
5.3.60.0050.01912.35
5.3.50.0030.02112.33
5.3.40.0040.02012.22
5.3.30.0020.02212.26
5.3.20.0070.01812.16
5.3.10.0020.02212.09
5.3.00.0070.01812.12
5.2.170.0030.05712.31
5.2.160.0000.03012.31
5.2.150.0000.03312.31
5.2.140.0030.03312.31
5.2.130.0030.02712.31
5.2.120.0030.02712.31
5.2.110.0000.03012.31
5.2.100.0000.03012.31
5.2.90.0000.03012.31
5.2.80.0030.03012.31
5.2.70.0100.02312.31
5.2.60.0100.02012.31
5.2.50.0000.02712.31
5.2.40.0070.02712.31
5.2.30.0000.02712.31
5.2.20.0070.02312.31
5.2.10.0030.02312.31
5.2.00.0000.02712.31
5.1.60.0030.02012.31
5.1.50.0000.02312.31
5.1.40.0070.01712.31
5.1.30.0030.02312.31
5.1.20.0000.03312.31
5.1.10.0000.03012.31
5.1.00.0030.02312.31
5.0.50.0000.01712.31
5.0.40.0000.02012.31
5.0.30.0030.02312.31
5.0.20.0000.02012.31
5.0.10.0000.02012.31
5.0.00.0030.02712.31
4.4.90.0030.01312.31
4.4.80.0000.01712.31
4.4.70.0000.01712.31
4.4.60.0030.01712.31
4.4.50.0000.01312.31
4.4.40.0000.02312.31
4.4.30.0000.01312.31
4.4.20.0030.01312.31
4.4.10.0030.01012.31
4.4.00.0030.02012.31
4.3.110.0000.01312.31
4.3.100.0030.01312.31
4.3.90.0000.01712.31
4.3.80.0000.02012.31
4.3.70.0000.01312.31
4.3.60.0030.01012.31
4.3.50.0000.01712.31
4.3.40.0070.01712.31
4.3.30.0000.01712.31
4.3.20.0000.01712.31
4.3.10.0030.01012.31
4.3.00.0000.01312.31

preferences:
42.37 ms | 400 KiB | 5 Q