3v4l.org

run code in 300+ PHP versions simultaneously
<?php class IDN { // adapt bias for punycode algorithm private static function punyAdapt( $delta, $numpoints, $firsttime ) { $delta = $firsttime ? $delta / 700 : $delta / 2; $delta += $delta / $numpoints; for ($k = 0; $delta > 455; $k += 36) $delta = intval($delta / 35); return $k + (36 * $delta) / ($delta + 38); } // make utf8 string from unicode codepoint number private static function utf8($cp) { if ($cp < 128) return chr($cp); if ($cp < 2048) return chr(192+($cp >> 6)).chr(128+($cp & 63)); if ($cp < 65536) return chr(224+($cp >> 12)). chr(128+(($cp >> 6) & 63)). chr(128+($cp & 63)); if ($cp < 2097152) return chr(240+($cp >> 18)). chr(128+(($cp >> 12) & 63)). chr(128+(($cp >> 6) & 63)). chr(128+($cp & 63)); // it should never get here } // main decoding function private static 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;) { $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 = IDN::punyAdapt($i - $oldi, $c, $oldi === 0); $n += (int)($i / $c); $i %= $c; array_splice($output, $i, 0, array(IDN::utf8($n))); $i++; } return implode("", $output); } public static function decodeIDN($name) { // split it, parse it and put it back together return implode( ".", array_map("IDN::decodePart",explode(".",$name)) ); } } echo 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.0040.01116.75
8.3.50.0170.00517.46
8.3.40.0130.01018.83
8.3.30.0110.00418.96
8.3.20.0000.00818.90
8.3.10.0050.00320.64
8.3.00.0040.00419.38
8.2.180.0110.00716.75
8.2.170.0160.00622.96
8.2.160.0070.00721.02
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0070.00026.16
8.2.120.0130.00721.01
8.2.110.0030.00721.12
8.2.100.0120.00017.89
8.2.90.0050.00319.30
8.2.80.0030.00519.20
8.2.70.0060.00317.74
8.2.60.0030.00617.91
8.2.50.0050.00318.07
8.2.40.0050.00318.09
8.2.30.0030.00718.24
8.2.20.0000.00817.72
8.2.10.0000.00917.90
8.2.00.0040.00417.79
8.1.280.0150.00025.92
8.1.270.0040.00424.66
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0070.00422.12
8.1.230.0120.00020.87
8.1.220.0030.00618.77
8.1.210.0000.00919.10
8.1.200.0100.00017.23
8.1.190.0030.00617.53
8.1.180.0100.00018.10
8.1.170.0000.00718.82
8.1.160.0040.00418.93
8.1.150.0050.00318.72
8.1.140.0040.00417.34
8.1.130.0030.00317.86
8.1.120.0000.00817.51
8.1.110.0000.00817.50
8.1.100.0030.00517.50
8.1.90.0070.00017.38
8.1.80.0040.00417.41
8.1.70.0050.00317.44
8.1.60.0080.00017.64
8.1.50.0000.00817.39
8.1.40.0030.00617.49
8.1.30.0060.00317.59
8.1.20.0040.00417.59
8.1.10.0040.00417.64
8.1.00.0080.00317.56
8.0.300.0030.00520.11
8.0.290.0000.00716.75
8.0.280.0000.00718.50
8.0.270.0000.00717.30
8.0.260.0000.00716.85
8.0.250.0000.00816.95
8.0.240.0000.00916.95
8.0.230.0030.00317.05
8.0.220.0030.00316.98
8.0.210.0040.00217.00
8.0.200.0030.00317.09
8.0.190.0000.00816.98
8.0.180.0000.00817.02
8.0.170.0080.00016.93
8.0.160.0000.00716.95
8.0.150.0040.00417.02
8.0.140.0040.00416.99
8.0.130.0030.00313.47
8.0.120.0040.00416.94
8.0.110.0040.00416.92
8.0.100.0070.00017.01
8.0.90.0040.00416.79
8.0.80.0060.00917.07
8.0.70.0040.00417.03
8.0.60.0040.00417.00
8.0.50.0050.00216.85
8.0.30.0090.01117.20
8.0.20.0140.00617.04
8.0.10.0000.00817.00
8.0.00.0110.00916.77
7.4.330.0000.00513.03
7.4.320.0000.00816.46
7.4.300.0000.00716.65
7.4.290.0000.00716.65
7.4.280.0040.00416.61
7.4.270.0030.00516.58
7.4.260.0050.00013.33
7.4.250.0080.00016.57
7.4.240.0050.00216.44
7.4.230.0000.00716.55
7.4.220.0120.00616.61
7.4.210.0100.00816.53
7.4.200.0000.00716.46
7.4.190.0030.00516.52
7.4.160.0120.00916.64
7.4.150.0120.00616.47
7.4.140.0100.01016.69
7.4.130.0110.00616.54
7.4.120.0070.01016.58
7.4.110.0140.00316.31
7.4.100.0170.00916.60
7.4.90.0140.00416.38
7.4.80.0090.00919.39
7.4.70.0080.00816.62
7.4.60.0070.01016.59
7.4.50.0050.00516.41
7.4.40.0060.00616.59
7.4.30.0040.01116.45
7.4.10.0070.01416.67
7.4.00.0060.00915.58
7.3.330.0000.00613.34
7.3.320.0000.00713.38
7.3.310.0000.00716.47
7.3.300.0070.00016.43
7.3.290.0000.01416.49
7.3.280.0090.00816.52
7.3.270.0070.01116.57
7.3.260.0080.01116.42
7.3.250.0110.00816.47
7.3.240.0080.01616.44
7.3.230.0060.01516.71
7.3.210.0070.01116.60
7.3.200.0060.01216.71
7.3.190.0140.00716.42
7.3.180.0140.00316.69
7.3.170.0130.00316.51
7.3.160.0060.01116.32
7.3.130.0070.01316.41
7.3.120.0060.01115.65
7.3.110.0030.01016.46
7.3.100.0100.00316.43
7.3.90.0080.00816.32
7.3.80.0090.00316.41
7.3.70.0100.01016.39
7.3.60.0100.00616.50
7.3.50.0040.00816.29
7.3.40.0030.01016.39
7.3.30.0040.01416.54
7.3.20.0000.01118.09
7.3.10.0030.00618.31
7.3.00.0080.00318.06
7.2.330.0030.01916.56
7.2.320.0150.00916.54
7.2.310.0200.00416.40
7.2.300.0130.00316.71
7.2.290.0130.00916.84
7.2.260.0100.01016.72
7.2.250.0100.01016.83
7.2.240.0040.01116.72
7.2.230.0030.01116.83
7.2.220.0040.00816.78
7.2.210.0030.01316.64
7.2.200.0090.00616.84
7.2.190.0070.01016.63
7.2.180.0000.01816.84
7.2.170.0000.01616.45
7.2.160.0090.00316.77
7.2.150.0070.01018.30
7.2.140.0000.01518.61
7.2.130.0030.01318.39
7.2.120.0030.01018.47
7.2.110.0070.01018.48
7.2.100.0080.00618.56
7.2.90.0030.00918.52
7.2.80.0080.00818.37
7.2.70.0030.00718.43
7.2.60.0080.00818.33
7.2.50.0070.01018.54
7.2.40.0080.00818.48
7.2.30.0000.01118.56
7.2.20.0090.00618.32
7.2.10.0090.00618.49
7.2.00.0110.00318.31
7.1.330.0120.00317.46
7.1.320.0080.00817.38
7.1.310.0110.00617.41
7.1.300.0040.00817.27
7.1.290.0060.01217.44
7.1.280.0110.00317.52
7.1.270.0000.01117.49
7.1.260.0040.01117.30
7.1.250.0030.00717.37
7.1.240.0090.00617.34
7.1.230.0060.01017.29
7.1.220.0030.01017.26
7.1.210.0140.00017.43
7.1.200.0090.00417.25
7.1.190.0070.01017.42
7.1.180.0040.01217.20
7.1.170.0070.01017.35
7.1.160.0090.00317.22
7.1.150.0030.01017.34
7.1.140.0030.01017.38
7.1.130.0030.01117.26
7.1.120.0030.00917.34
7.1.110.0120.00617.29
7.1.100.0140.01016.87
7.1.90.0030.00917.34
7.1.80.0030.01617.45
7.1.70.0030.01017.13
7.1.60.0090.01118.33
7.1.50.0090.00717.16
7.1.40.0000.01317.47
7.1.30.0060.00617.40
7.1.20.0090.00617.19
7.1.10.0040.01117.40
7.1.00.0070.03419.87
7.0.330.0030.00916.98
7.0.320.0070.01017.04
7.0.310.0000.01517.13
7.0.300.0060.00617.04
7.0.290.0070.00717.04
7.0.280.0040.00816.91
7.0.270.0060.01216.97
7.0.260.0100.00717.11
7.0.250.0060.00617.04
7.0.240.0080.00817.15
7.0.230.0070.00717.22
7.0.220.0030.01417.06
7.0.210.0090.00417.01
7.0.200.0030.00516.97
7.0.190.0060.00316.90
7.0.180.0030.01217.05
7.0.170.0030.00716.93
7.0.160.0090.00316.96
7.0.150.0000.01516.94
7.0.140.0120.03819.52
7.0.130.0080.00817.04
7.0.120.0030.03619.62
7.0.110.0080.00417.06
7.0.100.0040.00817.08
7.0.90.0090.00616.93
7.0.80.0070.00717.03
7.0.70.0040.01116.96
7.0.60.0070.02718.45
7.0.50.0070.03717.38
7.0.40.0090.02717.55
7.0.30.0180.04017.50
7.0.20.0150.02917.59
7.0.10.0200.04517.60
7.0.00.0050.02317.54
5.6.400.0070.00716.15
5.6.390.0090.00616.17
5.6.380.0060.00916.04
5.6.370.0000.01615.95
5.6.360.0070.00416.38
5.6.350.0100.00715.79
5.6.340.0030.01215.93
5.6.330.0100.01015.94
5.6.320.0060.00916.20
5.6.310.0000.01716.13
5.6.300.0060.00615.92
5.6.290.0100.00016.05
5.6.280.0080.04018.60
5.6.270.0070.01115.88
5.6.260.0000.01216.22
5.6.250.0000.01116.01
5.6.240.0100.00715.87
5.6.230.0060.00616.20
5.6.220.0130.00315.91
5.6.210.0070.04718.37
5.6.200.0090.04717.02
5.6.190.0050.02318.20
5.6.180.0200.03518.32
5.6.170.0220.03818.25
5.6.160.0150.04018.21
5.6.150.0090.03917.14
5.6.140.0070.02717.11
5.6.130.0050.02217.17
5.6.120.0070.04118.50
5.6.110.0070.04318.55
5.6.100.0100.03818.48
5.6.90.0110.02818.51
5.6.80.0100.03218.26
5.6.70.0190.02918.28
5.6.60.0040.01115.72
5.6.50.0060.00615.66
5.6.40.0130.00315.80
5.6.30.0030.00716.01
5.6.20.0040.00716.25
5.6.10.0040.01215.82
5.6.00.0040.00815.75
5.5.380.0000.01015.98
5.5.370.0030.01315.94
5.5.360.0040.00815.85
5.5.350.0180.04218.14
5.5.340.0050.04816.81
5.5.330.0020.02518.21
5.5.320.0100.02718.11
5.5.310.0160.04118.23
5.5.300.0070.02416.94
5.5.290.0080.04216.94
5.5.280.0050.04018.38
5.5.270.0060.02318.28
5.5.260.0050.02518.22
5.5.250.0100.04218.29
5.5.240.0030.04518.06
5.5.230.0070.01015.91
5.5.220.0040.01115.94
5.5.210.0080.00615.86
5.5.200.0040.00715.90
5.5.190.0040.00715.78
5.5.180.0100.00715.91
5.5.170.0030.01015.75
5.5.160.0040.00815.97
5.5.150.0070.00716.13
5.5.140.0040.01415.99
5.5.130.0060.00916.20
5.5.120.0060.00616.18
5.5.110.0040.00815.82
5.5.100.0070.01016.00
5.5.90.0000.01415.80
5.5.80.0040.01216.06
5.5.70.0070.00715.94
5.5.60.0060.00915.84
5.5.50.0070.00715.87
5.5.40.0000.01415.99
5.5.30.0040.00716.01
5.5.20.0070.00316.05
5.5.10.0040.00915.62
5.5.00.0040.00716.02
5.4.450.0120.04216.19
5.4.440.0120.02516.22
5.4.430.0160.03616.02
5.4.420.0150.03416.17
5.4.410.0100.02415.98
5.4.400.0170.03815.98
5.4.390.0150.02915.80
5.4.380.0080.02515.98
5.4.370.0080.03215.79
5.4.360.0130.02515.82
5.4.350.0120.01815.85
5.4.340.0130.02015.75
5.4.330.0080.00012.73
5.4.320.0040.03715.89
5.4.310.0000.03115.87
5.4.300.0080.04815.70
5.4.290.0060.02315.98
5.4.280.0030.02616.01
5.4.270.0030.02415.87
5.4.260.0650.02916.02
5.4.250.0910.02116.04
5.4.240.0830.02215.91
5.4.230.0870.02415.93
5.4.220.0820.03016.04
5.4.210.0080.01815.78
5.4.200.0050.02315.88
5.4.190.0070.02615.79
5.4.180.0740.02515.95
5.4.170.0040.03415.80
5.4.160.0130.03516.00
5.4.150.0360.02315.84
5.4.140.0890.02214.50
5.4.130.0020.02514.61
5.4.120.0050.02714.52
5.4.110.0030.02314.66
5.4.100.0530.02014.78
5.4.90.0920.02414.67
5.4.80.0850.02114.49
5.4.70.0980.02514.60
5.4.60.0030.02014.67
5.4.50.0070.02514.70
5.4.40.0040.02014.60
5.4.30.0780.02014.57
5.4.20.0050.03614.54
5.4.10.0000.02514.71
5.4.00.0400.03614.34
5.3.290.0600.02513.76
5.3.280.0100.02713.63
5.3.270.0020.03513.65
5.3.260.0060.03313.69
5.3.250.0760.02513.68
5.3.240.0850.03113.75
5.3.230.0900.02213.73
5.3.220.0020.03213.70
5.3.210.0010.02513.72
5.3.200.0000.02713.68
5.3.190.0780.02813.66
5.3.180.0890.02513.68
5.3.170.0950.02413.75
5.3.160.0880.02413.75
5.3.150.0920.02213.82
5.3.140.0760.01813.75
5.3.130.0650.02013.63
5.3.120.0270.02813.72
5.3.110.0050.03013.75
5.3.100.0050.02513.51
5.3.90.0270.02813.30
5.3.80.0820.02313.34
5.3.70.0960.02013.34
5.3.60.0800.02613.49
5.3.50.0950.02213.47
5.3.40.0900.02413.32
5.3.30.0930.02713.36
5.3.20.0920.02413.27
5.3.10.0850.02213.03
5.3.00.0830.02013.11
5.2.170.1570.03711.10
5.2.160.1370.03011.09
5.2.150.0130.03011.08
5.2.140.0030.02711.09
5.2.130.0030.02711.24
5.2.120.0970.02711.04
5.2.110.1430.02311.05
5.2.100.1570.03311.27
5.2.90.1570.03711.18
5.2.80.1600.03711.20
5.2.70.1500.04311.21
5.2.60.1570.03311.05
5.2.50.1600.03311.15
5.2.40.1200.03311.10
5.2.30.1100.03310.91
5.2.20.1070.03010.90
5.2.10.1070.03010.81
5.2.00.1100.02710.75
5.1.60.1200.02310.00
5.1.50.0370.04310.18
5.1.40.0030.04310.01
5.1.30.0000.04010.48
5.1.20.0030.03010.43
5.1.10.1000.02310.07
5.1.00.1170.01710.32
5.0.50.0730.0308.47
5.0.40.0630.0278.57
5.0.30.0500.0338.48
5.0.20.0530.0208.31
5.0.10.0530.0208.28
5.0.00.0070.0608.14
4.4.90.0000.0208.10
4.4.80.0000.0178.10
4.4.70.0100.0108.10
4.4.60.0000.0378.10
4.4.50.0100.0208.10
4.4.40.0000.0578.10
4.4.30.0000.0178.10
4.4.20.0030.0238.10
4.4.10.0170.0178.10
4.4.00.0530.0308.10
4.3.110.0530.0178.10
4.3.100.0600.0208.10
4.3.90.0730.0208.10
4.3.80.0600.0238.10
4.3.70.0570.0138.10
4.3.60.0730.0278.10
4.3.50.0570.0138.10
4.3.40.0530.0238.10
4.3.30.0330.0238.10
4.3.20.0300.0178.10
4.3.10.0330.0278.10
4.3.00.0300.0178.10

preferences:
36.54 ms | 400 KiB | 5 Q