3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IDN { private function adaptBias($delta, $numpoints, $first) { $delta = $first ? $delta / 700 : $delta / 2; $delta += $delta / $numPoints; for ($k = 0; $delta > 455; $k += 36) { $delta = (int)($delta / 35); } return $k + (36 * $delta) / ($delta + 38); } private function encodeUtf8CodePoint($codePoint) { switch (true) { case $codePoint < 0x80: return pack('C*', $codePoint & 0x7F); case $codePoint < 0x0800: return pack('C*', (($codePoint & 0x07C0) >> 6) | 0xC0, ($codePoint & 0x3F) | 0x80); case $codePoint < 0x010000: return pack('C*', (($codePoint & 0xF000) >> 12) | 0xE0, (($codePoint & 0x0FC0) >> 6) | 0x80, ($codePoint & 0x3F) | 0x80); case $codePoint < 0x110000: return pack('C*', (($codePoint & 0x1C0000) >> 18) | 0xF0, (($codePoint & 0x03F000) >> 12) | 0x80, (($codePoint & 0x0FC0) >> 6) | 0x80, ($codePoint & 0x3F) | 0x80); } return false; } public function decodePart($input) { if (substr($input, 0, 4) !== 'xn--') { return $input; } $input = substr($input, 4); if (false !== $nonBasicCharsStart = strrpos($input, '-')) { $output = str_split(substr($input, 0, $nonBasicCharsStart), 1); $nonBasicChars = substr($input, $nonBasicCharsStart + 1); } else { $output = []; $nonBasicChars = $input; } $n = 128; $i = 0; $bias = 72; for ($j = 0, $l = strlen($nonBasicChars); $j < $l; $i++) { $oldi = $i; $w = 1; $k = 36; while (true) { if (!isset($nonBasicChars[$j])) { return false; } $digit = ord($nonBasicChars[$j++]); if ($digit >= 0x61 && $digit <= 0x7A) { $digit -= 97; } else if ($digit >= 0x30 && $digit <= 0x39) { $digit -= 22; } else { return false; } $i += $digit * $w; if ($k <= $bias) { $t = 1; } else if ($k >= $bias + 26) { $t = 26; } else { $t = $k - $bias; } if ($digit < $t) { break; } $w *= (int) (36 - $t); $k += 36; } $c = count($output) + 1; $bias = $this->adaptBias($i - $oldi, $c, $oldi === 0); $n += (int)($i / $c); $i %= $c; array_splice($output, $i, 0, array($this->encodeUtf8CodePoint($n))); } return implode('', $output); } public function decodeIDN($name) { // split it, parse it and put it back together return implode( ".", array_map([$this, 'decodePart'],explode(".",$name)) ); } } echo (new IDN)->decodeIDN("xn---with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n");

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.0130.01016.63
8.3.50.0100.00521.20
8.3.40.0040.01418.97
8.3.30.0090.00519.17
8.3.20.0040.00420.33
8.3.10.0060.00321.95
8.3.00.0040.00422.42
8.2.180.0040.01118.29
8.2.170.0050.01022.96
8.2.160.0100.00719.15
8.2.150.0050.00324.18
8.2.140.0120.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00318.03
8.2.110.0030.00621.98
8.2.100.0040.00721.20
8.2.90.0040.00419.17
8.2.80.0050.00319.32
8.2.70.0030.00617.63
8.2.60.0000.00817.93
8.2.50.0030.00618.07
8.2.40.0000.00918.34
8.2.30.0040.00418.08
8.2.20.0030.00517.91
8.2.10.0000.00817.81
8.2.00.0030.00617.79
8.1.280.0140.00725.92
8.1.270.0040.00420.24
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.86
8.1.230.0000.01019.10
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0050.00317.53
8.1.180.0050.00318.75
8.1.170.0040.00418.50
8.1.160.0040.00422.20
8.1.150.0040.00418.72
8.1.140.0040.00417.40
8.1.130.0040.00417.92
8.1.120.0000.00717.51
8.1.110.0000.00817.51
8.1.100.0040.00417.47
8.1.90.0000.00817.49
8.1.80.0080.00017.44
8.1.70.0000.00717.40
8.1.60.0030.00617.55
8.1.50.0040.00417.55
8.1.40.0050.00317.62
8.1.30.0040.00417.57
8.1.20.0050.00317.69
8.1.10.0030.00617.65
8.1.00.0040.00417.55
8.0.300.0040.00418.77
8.0.290.0000.00717.28
8.0.280.0050.00318.54
8.0.270.0000.00817.25
8.0.260.0070.00016.81
8.0.250.0040.00317.03
8.0.240.0040.00416.97
8.0.230.0030.00517.00
8.0.220.0030.00316.91
8.0.210.0000.00817.04
8.0.200.0000.00717.05
8.0.190.0040.00417.05
8.0.180.0040.00316.91
8.0.170.0030.00617.05
8.0.160.0040.00417.04
8.0.150.0000.00716.84
8.0.140.0040.00417.02
8.0.130.0060.00013.46
8.0.120.0040.00417.00
8.0.110.0040.00416.96
8.0.100.0050.00317.00
8.0.90.0000.00716.98
8.0.80.0120.01216.99
8.0.70.0040.00416.85
8.0.60.0070.00017.03
8.0.50.0000.00816.87
8.0.30.0100.00817.33
8.0.20.0050.01317.40
8.0.10.0000.00817.11
8.0.00.0120.00716.61
7.4.330.0020.00215.00
7.4.320.0030.00316.61
7.4.300.0060.00016.57
7.4.290.0040.00416.57
7.4.280.0040.00416.65
7.4.270.0030.00416.54
7.4.260.0040.00416.43
7.4.250.0070.00016.60
7.4.240.0050.00216.60
7.4.230.0030.00316.63
7.4.220.0120.01016.54
7.4.210.0080.00816.62
7.4.200.0000.00816.45
7.4.190.0000.00816.46
7.4.160.0060.01416.37
7.4.150.0130.00417.40
7.4.140.0130.00817.86
7.4.130.0110.00816.56
7.4.120.0120.00616.71
7.4.110.0070.01016.61
7.4.100.0180.00616.69
7.4.90.0070.01016.57
7.4.80.0140.00719.39
7.4.70.0090.00916.66
7.4.60.0100.01016.68
7.4.50.0030.00616.63
7.4.40.0060.00922.77
7.4.30.0130.00316.42
7.4.10.0000.01915.18
7.4.00.0030.01315.02
7.3.330.0060.00013.43
7.3.320.0030.00313.43
7.3.310.0000.00716.49
7.3.300.0040.00416.57
7.3.290.0060.01516.47
7.3.280.0060.00916.47
7.3.270.0090.01217.40
7.3.260.0060.01116.55
7.3.250.0030.01516.55
7.3.240.0120.00616.66
7.3.230.0030.01616.51
7.3.210.0030.01416.50
7.3.200.0120.00619.39
7.3.190.0080.01316.51
7.3.180.0000.01716.63
7.3.170.0080.00916.56
7.3.160.0090.01216.50
7.3.130.0110.00315.18
7.3.120.0050.00914.79
7.3.110.0140.00314.79
7.3.100.0060.00814.87
7.3.90.0020.01214.94
7.3.80.0090.00915.14
7.3.70.0030.01014.99
7.3.60.0040.00815.00
7.3.50.0060.00914.98
7.3.40.0040.00614.94
7.3.30.0070.00514.59
7.3.20.0050.00516.72
7.3.10.0080.00716.77
7.3.00.0060.00316.68
7.2.330.0100.01016.66
7.2.320.0120.01216.84
7.2.310.0030.01316.71
7.2.300.0060.01216.61
7.2.290.0110.00616.82
7.2.260.0130.00614.88
7.2.250.0050.01015.04
7.2.240.0150.00315.06
7.2.230.0090.00615.17
7.2.220.0030.01115.23
7.2.210.0020.00915.09
7.2.200.0020.00914.96
7.2.190.0080.00515.21
7.2.180.0070.01015.03
7.2.170.0100.00315.26
7.2.160.0060.00615.22
7.2.150.0060.00916.96
7.2.140.0060.00316.95
7.2.130.0040.00816.95
7.2.120.0110.00616.94
7.2.110.0060.00817.03
7.2.100.0020.00816.97
7.2.90.0050.00716.94
7.2.80.0030.00716.99
7.2.70.0050.00916.92
7.2.60.0020.01016.99
7.2.50.0030.00816.94
7.2.40.0030.01117.08
7.2.30.0030.01017.10
7.2.20.0000.01416.73
7.2.10.0080.00617.01
7.2.00.0090.00717.83
7.1.330.0060.00815.63
7.1.320.0030.01215.92
7.1.310.0030.01215.93
7.1.300.0070.01015.65
7.1.290.0060.00615.62
7.1.280.0040.00715.69
7.1.270.0030.00715.75
7.1.260.0030.01015.79
7.1.250.0050.01015.73
7.1.240.0000.01315.94
7.1.230.0040.00415.79
7.1.220.0060.00315.61
7.1.210.0100.00615.94
7.1.200.0070.00515.87
7.1.190.0030.00715.80
7.1.180.0070.00715.70
7.1.170.0030.01015.54
7.1.160.0040.00415.74
7.1.150.0070.00315.95
7.1.140.0000.01415.95
7.1.130.0070.00715.66
7.1.120.0070.00315.88
7.1.110.0040.01115.75
7.1.100.0000.01316.94
7.1.90.0160.00015.59
7.1.80.0090.00915.89
7.1.70.0030.00616.48
7.1.60.0110.00417.84
7.1.50.0070.01016.41
7.1.40.0040.00715.86
7.1.30.0100.00315.87
7.1.20.0000.01415.86
7.1.10.0060.00916.02
7.1.00.0050.02719.03
7.0.330.0030.00715.43
7.0.320.0030.00615.44
7.0.310.0040.00415.15
7.0.300.0000.01315.44
7.0.290.0030.00715.43
7.0.280.0040.00715.61
7.0.270.0000.00815.48
7.0.260.0040.01215.52
7.0.250.0000.01515.51
7.0.240.0030.00515.44
7.0.230.0120.00315.57
7.0.220.0070.00715.49
7.0.210.0000.01415.62
7.0.200.0050.00616.00
7.0.190.0000.01115.42
7.0.180.0100.00015.30
7.0.170.0080.00315.47
7.0.160.0000.01415.55
7.0.150.0070.00715.22
7.0.140.0050.03718.86
7.0.130.0040.00715.53
7.0.120.0080.00815.34
7.0.110.0060.00315.28
7.0.100.0210.03917.77
7.0.90.0230.04217.73
7.0.80.0130.05417.72
7.0.70.0180.04717.80
7.0.60.0190.03517.86
7.0.50.0210.04017.97
7.0.40.0100.04016.75
7.0.30.0060.04416.61
7.0.20.0020.04816.71
7.0.10.0070.04216.81
7.0.00.0040.03716.83
5.6.400.0080.00414.13
5.6.390.0050.00614.64
5.6.380.0070.00714.48
5.6.370.0100.00314.30
5.6.360.0090.00314.59
5.6.350.0030.00614.58
5.6.340.0030.01014.59
5.6.330.0060.00914.94
5.6.320.0100.00314.60
5.6.310.0060.00914.46
5.6.300.0080.00414.41
5.6.290.0090.00614.53
5.6.280.0020.04117.73
5.6.270.0080.00414.74
5.6.260.0050.00514.27
5.6.250.0120.04017.53
5.6.240.0060.04817.60
5.6.230.0050.04717.59
5.6.220.0080.04217.59
5.6.210.0080.03117.48
5.6.200.0100.04317.71
5.6.190.0030.04617.74
5.6.180.0090.04517.83
5.6.170.0080.04117.78
5.6.160.0120.04317.67
5.6.150.0050.05117.81
5.6.140.0120.04617.75
5.6.130.0070.04517.67
5.6.120.0080.04217.74
5.6.110.0070.04217.68
5.6.100.0120.03618.00
5.6.90.0120.04217.80
5.6.80.0030.04517.46
5.6.70.0080.04317.43
5.6.60.0020.04517.28
5.6.50.0080.04317.30
5.6.40.0080.04217.46
5.6.30.0090.03717.40
5.6.20.0050.03117.37
5.6.10.0060.04217.53
5.6.00.0180.03517.37
5.5.380.0080.04217.50
5.5.370.0080.02317.38
5.5.360.0080.03617.40
5.5.350.0020.04017.22
5.5.340.0130.03617.65
5.5.330.0030.04817.76
5.5.320.0120.02517.61
5.5.310.0050.03917.58
5.5.300.0050.05117.65
5.5.290.0080.04217.72
5.5.280.0080.04617.61
5.5.270.0070.04717.67
5.5.260.0100.04117.70
5.5.250.0150.03817.53
5.5.240.0030.04317.44
5.5.230.0050.04617.22
5.5.220.0030.04517.27
5.5.210.0070.04517.39
5.5.200.0100.03817.09
5.5.190.0070.04417.26
5.5.180.0060.04317.24
5.5.170.0110.00314.33
5.5.160.0100.04017.34
5.5.150.0070.02817.26
5.5.140.0050.04517.35
5.5.130.0100.03817.35
5.5.120.0070.03617.16
5.5.110.0050.04517.03
5.5.100.0080.04217.32
5.5.90.0050.04017.18
5.5.80.0050.03017.21
5.5.70.0080.04217.29
5.5.60.0060.04317.18
5.5.50.0030.04617.20
5.5.40.0030.02717.28
5.5.30.0030.02817.01
5.5.20.0080.02217.21
5.5.10.0070.02517.03
5.5.00.0050.02517.20
5.4.450.0110.03815.24
5.4.440.0050.04415.37
5.4.430.0070.04015.38
5.4.420.0060.04215.22
5.4.410.0090.03915.14
5.4.400.0070.03915.10
5.4.390.0050.04315.03
5.4.380.0050.04015.15
5.4.370.0080.03614.90
5.4.360.0030.04015.24
5.4.350.0070.04015.05
5.4.340.0080.04115.05
5.4.330.0070.00311.09
5.4.320.0080.03215.02
5.4.310.0130.03315.21
5.4.300.0080.03515.09
5.4.290.0080.03714.94
5.4.280.0030.04315.23
5.4.270.0050.03815.13
5.4.260.0100.03515.18
5.4.250.0070.04215.30
5.4.240.0050.03515.08
5.4.230.0050.03215.08
5.4.220.0050.03915.10
5.4.210.0020.03615.22
5.4.200.0070.02815.16
5.4.190.0040.02615.18
5.4.180.0060.02215.13
5.4.170.0080.01814.88
5.4.160.0050.02014.91
5.4.150.0050.02314.97
5.4.140.0020.02313.57
5.4.130.0000.02413.82
5.4.120.0050.02013.67
5.4.110.0000.02413.75
5.4.100.0020.02013.90
5.4.90.0000.02313.87
5.4.80.0030.03513.76
5.4.70.0040.02213.80
5.4.60.0050.02813.96
5.4.50.0020.03413.76
5.4.40.0040.03013.77
5.4.30.0050.02713.80
5.4.20.0020.02713.72
5.4.10.0060.03113.60
5.4.00.0020.02013.37
5.3.290.0030.04312.48
5.3.280.0070.02412.42
5.3.270.0050.02312.40
5.3.260.0050.02112.61
5.3.250.0050.01912.36
5.3.240.0000.02612.44
5.3.230.0020.02212.51
5.3.220.0030.02212.29
5.3.210.0020.02212.34
5.3.200.0060.01812.33
5.3.190.0070.02212.50
5.3.180.0050.02012.49
5.3.170.0060.02212.57
5.3.160.0050.01812.44
5.3.150.0050.01812.61
5.3.140.0020.02312.50
5.3.130.0050.02012.54
5.3.120.0050.01812.50
5.3.110.0030.02912.52
5.3.100.0000.02612.33
5.3.90.0090.01512.16
5.3.80.0050.02212.16
5.3.70.0070.01912.27
5.3.60.0050.03212.24
5.3.50.0020.02412.16
5.3.40.0020.02512.11
5.3.30.0030.02112.07
5.3.20.0020.02212.13
5.3.10.0020.02611.94
5.3.00.0070.01711.88
5.2.170.0030.02712.07
5.2.160.0030.03712.07
5.2.150.0000.03312.07
5.2.140.0030.04712.07
5.2.130.0100.04712.07
5.2.120.0000.04012.07
5.2.110.0030.03312.07
5.2.100.0000.05312.07
5.2.90.0070.02312.07
5.2.80.0000.05712.07
5.2.70.0000.03012.07
5.2.60.0100.02012.07
5.2.50.0000.03012.07
5.2.40.0000.04312.07
5.2.30.0030.03012.07
5.2.20.0030.02712.07
5.2.10.0000.03012.07
5.2.00.0030.02712.07
5.1.60.0070.03012.07
5.1.50.0000.03712.07
5.1.40.0070.04012.07
5.1.30.0030.02712.07
5.1.20.0000.03012.07
5.1.10.0000.02712.07
5.1.00.0100.02712.07
5.0.50.0030.02012.07
5.0.40.0000.02012.07
5.0.30.0000.06712.07
5.0.20.0030.04012.07
5.0.10.0030.03312.07
5.0.00.0030.04712.07
4.4.90.0000.03012.07
4.4.80.0000.01712.07
4.4.70.0000.01712.07
4.4.60.0000.01712.07
4.4.50.0000.01712.07
4.4.40.0000.02312.07
4.4.30.0000.01712.07
4.4.20.0000.01312.07
4.4.10.0000.01712.07
4.4.00.0000.02312.07
4.3.110.0000.02012.07
4.3.100.0000.01712.07
4.3.90.0030.03712.07
4.3.80.0030.05012.07
4.3.70.0030.02712.07
4.3.60.0070.02712.07
4.3.50.0000.03312.07
4.3.40.0030.03012.07
4.3.30.0000.03312.07
4.3.20.0000.03712.07
4.3.10.0030.03312.07
4.3.00.0070.03012.07

preferences:
48.63 ms | 400 KiB | 5 Q