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); } // translate character to punycode number private static function decodeDigit($cp) { } // 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--") // prefix check... return $input; $input = substr($input,4); // discard prefix $a = explode("-",$input); if (count($a) > 1) { $input = str_split(array_pop($a)); $output = str_split(implode("-",$a)); } else { $output = array(); $input = str_split($input); } $n = 128; $i = 0; $bias = 72; // init punycode vars while (!empty($input)) { $oldi = $i; $w = 1; for ($k = 36;;) { $digit = ord(array_shift($input)); 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; } $bias = IDN::punyAdapt( $i-$oldi, count($output)+1, $oldi == 0 ); $n += intval($i / (count($output) + 1)); $i %= count($output) + 1; 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.0090.00916.50
8.3.50.0120.00416.53
8.3.40.0150.00018.85
8.3.30.0040.01118.71
8.3.20.0040.00718.93
8.3.10.0030.00620.53
8.3.00.0060.00319.16
8.2.180.0080.00816.88
8.2.170.0040.01222.96
8.2.160.0000.01421.13
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0070.00026.16
8.2.120.0080.00021.01
8.2.110.0070.00320.50
8.2.100.0040.00817.89
8.2.90.0000.00818.34
8.2.80.0000.00719.32
8.2.70.0050.00317.75
8.2.60.0000.00817.80
8.2.50.0060.00318.07
8.2.40.0030.00517.91
8.2.30.0090.00018.11
8.2.20.0080.00017.77
8.2.10.0040.00417.81
8.2.00.0030.00517.86
8.1.280.0110.00425.92
8.1.270.0050.00324.66
8.1.260.0030.00626.35
8.1.250.0040.00428.09
8.1.240.0030.00622.14
8.1.230.0100.00320.97
8.1.220.0030.00617.74
8.1.210.0000.00918.86
8.1.200.0060.00317.35
8.1.190.0080.00017.53
8.1.180.0060.00318.10
8.1.170.0040.00418.87
8.1.160.0050.00318.92
8.1.150.0000.00718.74
8.1.140.0050.00217.48
8.1.130.0000.00717.79
8.1.120.0030.00317.48
8.1.110.0040.00417.52
8.1.100.0040.00417.50
8.1.90.0000.00817.52
8.1.80.0050.00317.40
8.1.70.0000.00717.39
8.1.60.0080.00017.65
8.1.50.0030.00617.49
8.1.40.0040.00417.46
8.1.30.0040.00417.75
8.1.20.0000.00817.72
8.1.10.0000.00817.67
8.1.00.0030.00617.44
8.0.300.0080.00020.35
8.0.290.0000.00716.75
8.0.280.0000.00718.46
8.0.270.0050.00217.30
8.0.260.0000.00716.93
8.0.250.0000.00717.13
8.0.240.0040.00417.04
8.0.230.0040.00417.05
8.0.220.0070.00016.91
8.0.210.0040.00417.01
8.0.200.0000.00616.93
8.0.190.0030.00616.96
8.0.180.0060.00317.01
8.0.170.0030.00616.98
8.0.160.0040.00416.86
8.0.150.0040.00416.94
8.0.140.0070.00016.92
8.0.130.0000.00513.42
8.0.120.0040.00416.96
8.0.110.0080.00017.00
8.0.100.0040.00416.95
8.0.90.0030.00516.88
8.0.80.0130.00617.00
8.0.70.0070.00016.93
8.0.60.0000.00817.03
8.0.50.0030.00616.83
8.0.30.0110.00917.11
8.0.20.0110.00917.22
8.0.10.0070.00016.94
8.0.00.0080.01216.95
7.4.330.0000.00513.16
7.4.320.0060.00016.66
7.4.300.0000.00716.57
7.4.290.0000.00816.58
7.4.280.0000.00716.57
7.4.270.0040.00416.70
7.4.260.0030.00313.35
7.4.250.0050.00516.63
7.4.240.0040.00416.54
7.4.230.0070.00016.44
7.4.220.0110.00916.65
7.4.210.0090.00716.61
7.4.200.0030.00316.66
7.4.190.0030.00316.56
7.4.160.0090.00616.59
7.4.150.0140.01116.67
7.4.140.0100.01016.52
7.4.130.0140.00316.61
7.4.120.0070.01016.54
7.4.110.0110.00716.52
7.4.100.0040.01616.54
7.4.90.0150.00916.74
7.4.80.0090.01519.39
7.4.70.0140.00316.60
7.4.60.0030.01616.43
7.4.50.0050.00216.69
7.4.40.0080.01116.46
7.4.30.0060.00916.77
7.4.00.0100.00715.15
7.3.330.0040.00413.48
7.3.320.0030.00313.34
7.3.310.0070.00016.43
7.3.300.0070.00016.45
7.3.290.0070.00716.47
7.3.280.0080.01016.46
7.3.270.0090.00916.78
7.3.260.0180.00016.44
7.3.250.0090.01216.60
7.3.240.0110.00516.56
7.3.230.0170.00716.65
7.3.210.0090.00916.66
7.3.200.0120.00616.55
7.3.190.0160.00616.51
7.3.180.0150.00316.72
7.3.170.0130.00316.58
7.3.160.0090.00616.36
7.3.120.0000.01215.07
7.2.330.0080.01016.89
7.2.320.0140.01016.59
7.2.310.0120.01516.75
7.2.300.0110.01116.60
7.2.290.0060.01116.87
7.2.60.0030.01016.80
7.2.00.0070.00719.54
7.1.200.0080.00415.71
7.1.100.0060.00618.29
7.1.70.0000.01317.09
7.1.60.0090.01619.40
7.1.50.0100.01317.02
7.1.00.0030.04322.51
7.0.200.0070.00316.73
7.0.140.0030.07722.12
7.0.120.0000.07721.99
7.0.60.0030.08320.09
7.0.50.0030.04317.91
7.0.40.0100.06317.69
7.0.30.0130.06717.76
7.0.20.0070.08017.76
7.0.10.0130.06717.75
7.0.00.0170.04717.81
5.6.280.0100.06721.09
5.6.210.0000.04320.71
5.6.200.0100.08318.19
5.6.190.0070.07318.25
5.6.180.0030.04318.18
5.6.170.0070.08718.26
5.6.160.0070.07318.29
5.6.150.0100.06318.24
5.6.140.0030.08318.14
5.6.130.0100.07318.16
5.6.120.0200.03718.18
5.6.110.0100.08018.18
5.6.100.0100.07718.20
5.6.90.0100.05018.18
5.6.80.0100.07017.55
5.6.70.0030.08017.56
5.6.60.0100.07017.54
5.6.50.0030.08017.53
5.6.40.0130.04717.52
5.6.30.0130.07317.63
5.6.20.0000.08717.51
5.6.10.0070.07717.50
5.6.00.0100.07717.50
5.5.350.0270.06320.37
5.5.340.0130.04317.97
5.5.330.0130.07317.98
5.5.320.0130.07318.09
5.5.310.0070.08318.02
5.5.300.0000.06317.95
5.5.290.0070.07317.93
5.5.280.0070.08017.97
5.5.270.0170.06317.94
5.5.260.0100.07717.96
5.5.250.0030.05717.75
5.5.240.0000.08317.32
5.5.230.0000.07717.34
5.5.220.0070.08017.32
5.5.210.0100.07717.33
5.5.200.0170.06717.32
5.5.190.0070.08017.32
5.5.180.0030.06317.29
5.5.160.0030.04717.29
5.5.150.0030.03717.34
5.5.140.0070.03717.28
5.5.130.0000.04017.32
5.5.120.0000.04017.33
5.5.110.0000.04017.33
5.5.100.0030.03717.23
5.5.90.0030.04317.20
5.5.80.0000.04017.24
5.5.70.0000.04017.32
5.5.60.0030.03717.32
5.5.50.0070.03717.22
5.5.40.0030.03717.29
5.5.30.0030.03717.23
5.5.20.0130.02717.22
5.5.10.0030.03717.23
5.5.00.0100.03017.19
5.4.450.0070.07019.42
5.4.440.0000.05019.18
5.4.430.0070.08319.42
5.4.420.0030.06319.36
5.4.410.0070.03719.30
5.4.400.0130.06318.89
5.4.390.0030.06319.14
5.4.380.0000.05019.12
5.4.370.0070.05319.05
5.4.360.0070.07719.12
5.4.350.0100.04319.03
5.4.340.0170.06318.98
5.4.320.0030.04719.04
5.4.310.0030.03719.04
5.4.300.0000.04018.97
5.4.290.0070.03319.03
5.4.280.0030.03719.09
5.4.270.0100.03019.00
5.4.260.0030.03719.26
5.4.250.0070.03318.97
5.4.240.0070.04319.11
5.4.230.0030.03719.01
5.4.220.0100.03319.05
5.4.210.0000.04019.00
5.4.200.0070.03319.11
5.4.190.0030.03719.26
5.4.180.0030.03719.11
5.4.170.0070.03319.08
5.4.160.0000.04018.99
5.4.150.0000.04019.11
5.4.140.0000.03716.45
5.4.130.0030.03316.31
5.4.120.0000.03716.42
5.4.110.0070.03016.45
5.4.100.0070.03016.32
5.4.90.0030.03316.45
5.4.80.0000.03716.30
5.4.70.0100.03716.44
5.4.60.0030.03716.38
5.4.50.0030.03316.50
5.4.40.0030.03316.61
5.4.30.0030.03316.23
5.4.20.0030.03316.39
5.4.10.0100.06716.44
5.4.00.0070.07015.82
5.3.290.0070.03314.80
5.3.280.0030.03714.66
5.3.270.0070.04314.68
5.3.260.0000.04014.66
5.3.250.0030.03314.49
5.3.240.0070.03714.65
5.3.230.0030.03714.62
5.3.220.0030.04014.64
5.3.210.0000.04314.64
5.3.200.0030.03314.56
5.3.190.0000.04014.67
5.3.180.0000.04014.64
5.3.170.0070.03314.64
5.3.160.0070.03314.55
5.3.150.0070.03314.81
5.3.140.0030.03714.62
5.3.130.0030.03714.54
5.3.120.0000.04014.61
5.3.110.0100.07014.68
5.3.100.0070.07014.11
5.3.90.0100.06014.09
5.3.80.0030.04314.05
5.3.70.0000.04314.08
5.3.60.0070.06314.05
5.3.50.0030.03714.07
5.3.40.0200.06014.03
5.3.30.0000.08314.06
5.3.20.0070.05713.79
5.3.10.0030.04313.68
5.3.00.0100.06713.68
5.2.170.0030.06011.04
5.2.160.0100.03711.28
5.2.150.0030.06011.07
5.2.140.0030.06011.08
5.2.130.0030.06711.13
5.2.120.0030.04311.17
5.2.110.0000.06711.24
5.2.100.0000.04711.18
5.2.90.0070.05311.03
5.2.80.0070.06011.12
5.2.70.0070.04711.13
5.2.60.0070.04711.11
5.2.50.0070.06011.10
5.2.40.0070.05711.11
5.2.30.0130.02711.08
5.2.20.0070.06311.04
5.2.10.0030.06010.86
5.2.00.0070.06710.80
5.1.60.0000.03310.00
5.1.50.0070.04710.13
5.1.40.0030.02310.03
5.1.30.0130.05010.22
5.1.20.0030.05710.48
5.1.10.0000.0639.90
5.1.00.0000.0379.95
5.0.50.0000.0338.43
5.0.40.0070.0438.45
5.0.30.0030.0578.32
5.0.20.0000.0478.27
5.0.10.0070.0408.24
5.0.00.0000.0338.30
4.4.90.0070.0237.54
4.4.80.0030.0207.54
4.4.70.0070.0337.54
4.4.60.0030.0337.54
4.4.50.0070.0307.54
4.4.40.0030.0537.54
4.4.30.0030.0177.54
4.4.20.0000.0337.54
4.4.10.0030.0337.54
4.4.00.0000.0537.54
4.3.110.0000.0377.54
4.3.100.0000.0307.54
4.3.90.0100.0307.54
4.3.80.0000.0577.54
4.3.70.0030.0177.54
4.3.60.0000.0337.54
4.3.50.0000.0177.54
4.3.40.0070.0437.54
4.3.30.0030.0237.54
4.3.20.0000.0277.54
4.3.10.0000.0237.54
4.3.00.0000.0337.54

preferences:
43.65 ms | 401 KiB | 5 Q