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 ($longs[1] & 0x80000000) { $longs[1] = (($longs[1] & 0x7FFFFFFF) * 2) + ~$longs[1] + 1; } if ($isSigned && $signBit) { $result = ($longs[0] * pow(2, 32)) + $longs[1]; } else { if ($signBit) { $longs[0] = (($longs[0] & 0x7FFFFFFF) * 2) + ~$longs[0] + 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("\xFF\xFF\xFF\xFE\x00\x00\x00\x00", 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.0120.00918.30
8.3.50.0110.00721.92
8.3.40.0090.00618.88
8.3.30.0090.00618.62
8.3.20.0040.00418.79
8.3.10.0040.00421.22
8.3.00.0030.00623.53
8.2.180.0090.00916.63
8.2.170.0070.00722.96
8.2.160.0100.00320.38
8.2.150.0080.00024.18
8.2.140.0090.00024.66
8.2.130.0050.00526.16
8.2.120.0040.00421.00
8.2.110.0070.00320.52
8.2.100.0040.00717.84
8.2.90.0000.00819.17
8.2.80.0000.00719.38
8.2.70.0060.00317.63
8.2.60.0050.00517.80
8.2.50.0030.00618.07
8.2.40.0000.00818.27
8.2.30.0040.00421.22
8.2.20.0040.00417.77
8.2.10.0060.00317.67
8.2.00.0000.00817.67
8.1.280.0110.00425.92
8.1.270.0030.00523.99
8.1.260.0080.00626.35
8.1.250.0000.00828.09
8.1.240.0080.00022.61
8.1.230.0080.00322.72
8.1.220.0000.00818.77
8.1.210.0040.00419.06
8.1.200.0000.01017.35
8.1.190.0080.00017.50
8.1.180.0000.00818.10
8.1.170.0090.00018.68
8.1.160.0040.00419.04
8.1.150.0000.00818.68
8.1.140.0050.00317.49
8.1.130.0000.00717.75
8.1.120.0000.00717.48
8.1.110.0000.00817.51
8.1.100.0000.00717.53
8.1.90.0040.00317.41
8.1.80.0000.00717.42
8.1.70.0000.00717.39
8.1.60.0030.00617.66
8.1.50.0040.00417.40
8.1.40.0040.00417.55
8.1.30.0040.00417.64
8.1.20.0040.00417.61
8.1.10.0040.00417.64
8.1.00.0000.00817.59
8.0.300.0080.00019.94
8.0.290.0000.00717.18
8.0.280.0030.00318.49
8.0.270.0050.00217.35
8.0.260.0060.00016.79
8.0.250.0020.00517.04
8.0.240.0000.00816.99
8.0.230.0000.00717.02
8.0.220.0000.00716.79
8.0.210.0070.00016.85
8.0.200.0040.00517.01
8.0.190.0080.00016.86
8.0.180.0070.00016.88
8.0.170.0080.00017.00
8.0.160.0000.00716.85
8.0.150.0040.00416.95
8.0.140.0000.00716.85
8.0.130.0000.00713.30
8.0.120.0080.00016.95
8.0.110.0070.00016.83
8.0.100.0040.00416.80
8.0.90.0040.00416.91
8.0.80.0030.01316.91
8.0.70.0000.00716.73
8.0.60.0080.00016.93
8.0.50.0050.00217.04
8.0.30.0140.00517.13
8.0.20.0130.00717.40
8.0.10.0040.00417.05
8.0.00.0080.01016.99
7.4.330.0030.00316.77
7.4.320.0030.00316.57
7.4.300.0060.00016.66
7.4.290.0050.00316.47
7.4.280.0000.00816.64
7.4.270.0000.00716.60
7.4.260.0030.00313.31
7.4.250.0080.00016.37
7.4.240.0000.00816.63
7.4.230.0070.00016.53
7.4.220.0060.00916.56
7.4.210.0060.00816.59
7.4.200.0000.00716.43
7.4.190.0030.00516.50
7.4.160.0060.01616.46
7.4.150.0030.01717.40
7.4.140.0110.01017.86
7.4.130.0060.01216.67
7.4.120.0040.01316.64
7.4.110.0170.00416.52
7.4.100.0100.00716.62
7.4.90.0100.01016.65
7.4.80.0040.01319.39
7.4.70.0100.00716.51
7.4.60.0130.00616.56
7.4.50.0080.00016.62
7.4.40.0000.01722.77
7.4.30.0130.01016.46
7.4.00.0070.01014.98
7.3.330.0000.00513.41
7.3.320.0030.00313.48
7.3.310.0000.00716.22
7.3.300.0040.00416.38
7.3.290.0070.01016.39
7.3.280.0110.00716.35
7.3.270.0070.01017.40
7.3.260.0090.01118.24
7.3.250.0150.00816.67
7.3.240.0130.01016.58
7.3.230.0060.01216.39
7.3.210.0100.00716.41
7.3.200.0100.01319.39
7.3.190.0070.01416.36
7.3.180.0150.00616.49
7.3.170.0060.01216.65
7.3.160.0070.01016.60
7.3.120.0030.00914.61
7.3.00.0070.00716.49
7.2.330.0150.00316.59
7.2.320.0170.00716.57
7.2.310.0110.00816.78
7.2.300.0140.01016.68
7.2.290.0100.00716.54
7.2.130.0240.00716.75
7.2.120.0110.00716.77
7.2.110.0130.00616.90
7.2.100.0070.01116.79
7.2.90.0100.00716.64
7.2.80.0090.00616.98
7.2.70.0090.00616.98
7.2.60.0140.00416.57
7.2.50.0130.00716.64
7.2.40.0100.00716.52
7.2.30.0040.00816.78
7.2.20.0110.00716.71
7.2.10.0150.00417.02
7.2.00.0110.01116.95
7.1.250.0100.00715.88
7.1.240.0000.01115.84
7.1.230.0140.00015.59
7.1.220.0070.00715.54
7.1.210.0080.00815.57
7.1.200.0090.00615.56
7.1.190.0040.01115.69
7.1.180.0070.00715.77
7.1.170.0100.00615.45
7.1.160.0100.00315.51
7.1.150.0030.01215.54
7.1.140.0090.00915.58
7.1.130.0110.00715.55
7.1.120.0090.00615.65
7.1.110.0130.00715.62
7.1.100.0090.00315.82
7.1.90.0070.00715.72
7.1.80.0120.00615.75
7.1.70.0080.00516.42
7.1.60.0060.00516.40
7.1.50.0060.01316.12
7.1.40.0060.01015.74
7.1.30.0160.00615.82
7.1.20.0060.00915.71
7.1.10.0110.00315.29
7.1.00.0080.02619.17
7.0.330.0130.00315.51
7.0.320.0060.00915.09
7.0.310.0060.00615.37
7.0.300.0070.00715.29
7.0.290.0070.01015.12
7.0.280.0120.00915.04
7.0.270.0160.00315.34
7.0.260.0170.00315.38
7.0.250.0120.00615.32
7.0.240.0070.00715.20
7.0.230.0100.00715.54
7.0.220.0030.00715.50
7.0.210.0150.00715.14
7.0.200.0060.00616.00
7.0.190.0150.00015.25
7.0.180.0140.00414.88
7.0.170.0070.00715.08
7.0.160.0070.01015.13
7.0.150.0150.00415.02
7.0.140.0140.03318.50
7.0.130.0160.00315.13
7.0.120.0100.01015.22
7.0.110.0090.00915.41
7.0.100.0070.01015.13
7.0.90.0080.00815.30
7.0.80.0080.00815.32
7.0.70.0080.02018.45
7.0.60.0050.02718.43
7.0.50.0060.02618.77
7.0.40.0050.02316.71
7.0.30.0030.02416.84
7.0.20.0020.02616.71
7.0.10.0070.02216.66
7.0.00.0030.03016.77
5.6.380.0030.00814.42
5.6.370.0090.00314.46
5.6.360.0030.01314.13
5.6.350.0000.01713.89
5.6.340.0030.00914.36
5.6.330.0070.00314.09
5.6.320.0030.00914.34
5.6.310.0110.00014.40
5.6.300.0050.00814.09
5.6.290.0030.00914.52
5.6.280.0040.03717.61
5.6.270.0040.00714.14
5.6.260.0120.00014.02
5.6.250.0000.01513.93
5.6.240.0120.00014.10
5.6.230.0080.00513.76
5.6.220.0040.02717.61
5.6.210.0070.04317.40
5.6.200.0030.02517.61
5.6.190.0020.02417.80
5.6.180.0040.02317.77
5.6.170.0050.02117.47
5.6.160.0060.04517.62
5.6.150.0070.02117.53
5.6.140.0050.02317.53
5.6.130.0020.02917.63
5.6.120.0020.02917.72
5.6.110.0030.04817.61
5.6.100.0050.02717.57
5.6.90.0050.02017.70
5.6.80.0020.02517.29
5.6.70.0050.01917.15
5.6.60.0050.02517.14
5.6.50.0040.02917.33
5.6.40.0080.02217.17
5.6.30.0070.02017.35
5.6.20.0030.02317.13
5.6.10.0070.01517.33
5.6.00.0020.04417.21
5.5.380.0040.00411.26
5.5.370.0000.00711.23
5.5.360.0060.02215.75
5.5.350.0000.02415.86
5.5.340.0060.02215.98
5.5.330.0050.02116.04
5.5.320.0020.02516.01
5.5.310.0060.02316.07
5.5.300.0020.02516.11
5.5.290.0030.03116.22
5.5.280.0050.03616.00
5.5.270.0090.03215.90
5.5.260.0020.04816.01
5.5.250.0050.03515.96
5.5.240.0030.03715.60
5.5.230.0030.01915.83
5.5.220.0050.03715.58
5.5.210.0030.04515.61
5.5.200.0080.01615.72
5.5.190.0020.02715.60
5.5.180.0020.04515.60
5.5.170.0000.00810.93
5.5.160.0080.03315.61
5.5.150.0020.02115.71
5.5.140.0050.02715.63
5.5.130.0080.02015.67
5.5.120.0000.03415.60
5.5.110.0050.01715.64
5.5.100.0030.02115.53
5.5.90.0040.02015.61
5.5.80.0060.02115.45
5.5.70.0030.02015.73
5.5.60.0080.04015.30
5.5.50.0040.04115.46
5.5.40.0100.03815.56
5.5.30.0070.02515.52
5.5.20.0080.04015.42
5.5.10.0030.03915.64
5.5.00.0030.03015.32
5.4.450.0030.02115.23
5.4.440.0060.03815.27
5.4.430.0050.04215.10
5.4.420.0040.04515.24
5.4.410.0000.02615.16
5.4.400.0000.02215.06
5.4.390.0020.01914.90
5.4.380.0020.02214.92
5.4.370.0030.02615.08
5.4.360.0030.02014.98
5.4.350.0040.02014.96
5.4.340.0040.04114.85
5.4.330.0060.00611.22
5.4.320.0020.02015.08
5.4.310.0030.02614.91
5.4.300.0050.02214.83
5.4.290.0050.03614.96
5.4.280.0030.02015.01
5.4.270.0060.01615.02
5.4.260.0040.02515.06
5.4.250.0040.02014.84
5.4.240.0000.02415.03
5.4.230.0020.02215.00
5.4.220.0040.03115.01
5.4.210.0050.02914.98
5.4.200.0030.04315.10
5.4.190.0090.04215.21
5.4.180.0110.03515.06
5.4.170.0080.03815.04
5.4.160.0050.04314.77
5.4.150.0020.03814.98
5.4.140.0010.04113.82
5.4.130.0030.03713.70
5.4.120.0060.03313.85
5.4.110.0020.04013.81
5.4.100.0070.03713.76
5.4.90.0030.03613.74
5.4.80.0020.03013.64
5.4.70.0020.02313.80
5.4.60.0020.02213.75
5.4.50.0030.03813.77
5.4.40.0010.03613.64
5.4.30.0030.02813.75
5.4.20.0080.03113.71
5.4.10.0000.04313.59
5.4.00.0050.03513.21
5.3.290.0040.04612.67
5.3.280.0030.02012.51
5.3.270.0090.04212.52
5.3.260.0050.04012.70
5.3.250.0030.02812.68
5.3.240.0080.03712.52
5.3.230.0020.02812.52
5.3.220.0000.03912.59
5.3.210.0030.04312.55
5.3.200.0000.03212.52
5.3.190.0020.04312.50
5.3.180.0030.04012.68
5.3.170.0020.04012.60
5.3.160.0000.02312.70
5.3.150.0020.04312.64
5.3.140.0070.03812.64
5.3.130.0000.04612.60
5.3.120.0070.03812.64
5.3.110.0010.04312.58
5.3.100.0080.02312.39
5.3.90.0010.02812.38
5.3.80.0030.02512.09
5.3.70.0040.03712.34
5.3.60.0020.03312.34
5.3.50.0040.03012.28
5.3.40.0040.04212.30
5.3.30.0040.03512.29
5.3.20.0040.03912.14
5.3.10.0000.04211.92
5.3.00.0060.02612.03
5.2.170.0030.03511.08
5.2.160.0000.03311.08
5.2.150.0020.02511.08
5.2.140.0030.03511.08
5.2.130.0020.03411.08
5.2.120.0000.03311.08
5.2.110.0060.02611.08
5.2.100.0050.03011.08
5.2.90.0060.02211.08
5.2.80.0020.02011.08
5.2.70.0040.02111.08
5.2.60.0070.03111.08
5.2.50.0010.03611.08
5.2.40.0050.03011.08
5.2.30.0000.02711.08
5.2.20.0080.03011.08
5.2.10.0030.03111.08
5.2.00.0050.03211.08
5.1.60.0020.02711.08
5.1.50.0050.02811.08
5.1.40.0000.02511.08
5.1.30.0020.01911.08
5.1.20.0020.02111.08
5.1.10.0010.02311.08
5.1.00.0010.02011.08
5.0.50.0050.02011.08
5.0.40.0030.02311.08
5.0.30.0020.03311.08
5.0.20.0060.01311.08
5.0.10.0000.01611.08
5.0.00.0020.02011.08
4.4.90.0000.02211.08
4.4.80.0030.01311.08
4.4.70.0020.01711.08
4.4.60.0050.01311.08
4.4.50.0020.02011.08
4.4.40.0030.02611.08
4.4.30.0030.01711.08
4.4.20.0000.01611.08
4.4.10.0050.01511.08
4.4.00.0020.02711.08
4.3.110.0000.02111.08
4.3.100.0030.01711.08
4.3.90.0010.01111.08
4.3.80.0020.01411.08
4.3.70.0020.02011.08
4.3.60.0030.00811.08
4.3.50.0010.01511.08
4.3.40.0020.02511.08
4.3.30.0050.01811.08
4.3.20.0020.01811.08
4.3.10.0020.01711.08
4.3.00.0020.01311.08

preferences:
55.69 ms | 400 KiB | 5 Q