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) { $cp = strtolower($cp); if ($cp >= 'a' && $cp <= 'z') return ord($cp) - ord('a'); elseif ($cp >= '0' && $cp <= '9') return ord($cp) - ord('0')+26; } // 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;;$k += 36) { $digit = IDN::decodeDigit(array_shift($input)); $i += $digit * $w; if ($k <= $bias) $t = 1; elseif ($k >= $bias + 26) $t = 26; else $t = $k - $bias; if ($digit < $t) break; $w *= intval(36 - $t); } $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("3B-ww4c5e180e575a65lsy2b");

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.01118.30
8.3.50.0110.00521.14
8.3.40.0180.00318.84
8.3.30.0110.00318.92
8.3.20.0040.00420.14
8.3.10.0050.00321.91
8.3.00.0090.00022.37
8.2.180.0120.00616.32
8.2.170.0100.00722.96
8.2.160.0070.01419.04
8.2.150.0050.00324.18
8.2.140.0060.00324.66
8.2.130.0120.00326.16
8.2.120.0040.00419.41
8.2.110.0040.00722.12
8.2.100.0040.01117.72
8.2.90.0060.00319.09
8.2.80.0000.00817.97
8.2.70.0000.00817.38
8.2.60.0040.00418.04
8.2.50.0040.00418.07
8.2.40.0040.00418.22
8.2.30.0030.00618.11
8.2.20.0040.00417.61
8.2.10.0040.00417.75
8.2.00.0000.00817.67
8.1.280.0110.00325.92
8.1.270.0000.00820.26
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0030.00620.86
8.1.230.0110.00017.52
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0040.00717.23
8.1.190.0060.00317.41
8.1.180.0040.00418.67
8.1.170.0050.00318.66
8.1.160.0070.00022.12
8.1.150.0000.00718.62
8.1.140.0040.00417.47
8.1.130.0000.00717.80
8.1.120.0000.00717.42
8.1.110.0080.00017.45
8.1.100.0060.00317.34
8.1.90.0070.00017.49
8.1.80.0000.00717.43
8.1.70.0000.00717.38
8.1.60.0060.00317.59
8.1.50.0040.00417.45
8.1.40.0050.00317.46
8.1.30.0000.00817.55
8.1.20.0050.00317.56
8.1.10.0000.00817.58
8.1.00.0030.00517.38
8.0.300.0000.00718.77
8.0.290.0000.00716.88
8.0.280.0030.00318.36
8.0.270.0040.00417.38
8.0.260.0060.00016.86
8.0.250.0000.00717.03
8.0.240.0030.00616.94
8.0.230.0070.00016.98
8.0.220.0030.00316.88
8.0.210.0000.00716.87
8.0.200.0000.00616.85
8.0.190.0050.00516.96
8.0.180.0040.00416.89
8.0.170.0000.00716.82
8.0.160.0000.00816.82
8.0.150.0070.00016.72
8.0.140.0050.00216.81
8.0.130.0000.00613.33
8.0.120.0070.00016.66
8.0.110.0040.00416.71
8.0.100.0000.00816.70
8.0.90.0000.00716.93
8.0.80.0100.00716.80
8.0.70.0000.00716.88
8.0.60.0040.00416.76
8.0.50.0040.00416.68
8.0.30.0050.01316.78
8.0.20.0090.00917.40
8.0.10.0050.00316.95
8.0.00.0090.00816.75
7.4.330.0000.00615.00
7.4.320.0000.00616.48
7.4.300.0000.00616.59
7.4.290.0000.01116.64
7.4.280.0030.00316.62
7.4.270.0000.00816.42
7.4.260.0030.00316.50
7.4.250.0000.00716.43
7.4.240.0030.00416.49
7.4.230.0070.00016.53
7.4.220.0140.00616.66
7.4.210.0080.00816.49
7.4.200.0040.00416.39
7.4.190.0050.00316.56
7.4.160.0000.01616.63
7.4.150.0070.01017.40
7.4.140.0080.01317.86
7.4.130.0070.01016.51
7.4.120.0110.00616.51
7.4.110.0100.00716.61
7.4.100.0070.01016.66
7.4.90.0160.00316.46
7.4.80.0060.01219.39
7.4.70.0060.00916.59
7.4.60.0080.00816.54
7.4.50.0040.00016.47
7.4.40.0030.01222.77
7.4.30.0170.00016.45
7.4.00.0070.01014.87
7.3.330.0020.00213.22
7.3.320.0020.00413.28
7.3.310.0050.00216.33
7.3.300.0030.00316.40
7.3.290.0110.00316.33
7.3.280.0070.00916.34
7.3.270.0070.01017.40
7.3.260.0070.01716.34
7.3.250.0140.00616.42
7.3.240.0040.01416.60
7.3.230.0230.00016.53
7.3.210.0120.00616.23
7.3.200.0090.00919.39
7.3.190.0070.01416.59
7.3.180.0080.00816.62
7.3.170.0040.01216.63
7.3.160.0090.00616.47
7.3.120.0050.01014.88
7.3.110.0120.00314.74
7.3.100.0100.00715.00
7.3.90.0060.00914.71
7.3.80.0070.00615.02
7.3.70.0000.01414.79
7.3.60.0040.01414.70
7.3.50.0070.00714.91
7.3.40.0090.00414.78
7.3.30.0000.01414.61
7.3.20.0060.00916.80
7.3.10.0030.01016.66
7.3.00.0070.00816.55
7.2.330.0070.01116.56
7.2.320.0120.00616.35
7.2.310.0150.02416.38
7.2.300.0000.01616.79
7.2.290.0130.00316.58
7.2.250.0000.01614.95
7.2.240.0040.01515.23
7.2.230.0090.00615.12
7.2.220.0090.00614.67
7.2.210.0070.01315.17
7.2.200.0000.01615.21
7.2.190.0040.01214.77
7.2.180.0070.01115.07
7.2.170.0030.00914.88
7.2.130.0150.00316.85
7.2.120.0000.01616.71
7.2.110.0100.01016.96
7.2.100.0060.00916.80
7.2.90.0070.00716.87
7.2.80.0100.00316.97
7.2.70.0100.00716.84
7.2.60.0000.01316.90
7.2.50.0090.00916.84
7.2.40.0060.00916.67
7.2.30.0070.01016.68
7.2.20.0000.01216.59
7.2.10.0080.00416.55
7.2.00.0080.00316.93
7.1.330.0110.00315.72
7.1.320.0070.00715.86
7.1.310.0090.00915.79
7.1.300.0090.00615.78
7.1.290.0030.00915.44
7.1.280.0030.01015.72
7.1.270.0070.00715.54
7.1.260.0060.00315.59
7.1.250.0100.00315.88
7.1.240.0070.01015.48
7.1.230.0100.00315.74
7.1.220.0060.01015.66
7.1.210.0000.01315.52
7.1.200.0000.01615.74
7.1.190.0080.00015.76
7.1.180.0130.00315.47
7.1.170.0070.00715.62
7.1.160.0140.00715.45
7.1.150.0000.01515.62
7.1.140.0040.00715.79
7.1.130.0000.01215.45
7.1.120.0040.00715.69
7.1.110.0060.00915.49
7.1.100.0080.00415.93
7.1.90.0000.01215.70
7.1.80.0090.00415.87
7.1.70.0120.00216.29
7.1.60.0080.00817.85
7.1.50.0070.01216.16
7.1.40.0200.00615.97
7.1.30.0040.01115.55
7.1.20.0070.00715.88
7.1.10.0060.01215.63
7.1.00.0070.02119.01
7.0.330.0070.01015.43
7.0.320.0030.01015.44
7.0.310.0040.00415.13
7.0.300.0100.00315.37
7.0.290.0040.00715.42
7.0.280.0070.00415.36
7.0.270.0030.00715.39
7.0.260.0000.01115.04
7.0.250.0000.01115.38
7.0.240.0040.00715.48
7.0.230.0030.00615.39
7.0.220.0040.00715.50
7.0.210.0060.00615.48
7.0.200.0060.00516.05
7.0.190.0150.00615.37
7.0.180.0040.01214.89
7.0.170.0130.00915.22
7.0.160.0110.01515.34
7.0.150.0100.00715.03
7.0.140.0060.03818.73
7.0.130.0090.00615.32
7.0.120.0110.00415.34
7.0.110.0110.00715.39
7.0.100.0030.00615.22
7.0.90.0030.00715.00
7.0.80.0030.01015.07
7.0.70.0030.01015.26
7.0.60.0070.02317.71
7.0.50.0080.02516.66
7.0.40.0100.02316.68
7.0.30.0200.04216.66
7.0.20.0170.02816.82
7.0.10.0170.02416.70
7.0.00.0030.02416.75
5.6.380.0060.00914.27
5.6.370.0030.01214.24
5.6.360.0060.01114.36
5.6.350.0030.01514.43
5.6.340.0070.00714.24
5.6.330.0110.00614.37
5.6.320.0060.01013.85
5.6.310.0160.00414.66
5.6.300.0090.00614.61
5.6.290.0030.01314.03
5.6.280.0060.03817.68
5.6.270.0070.00314.50
5.6.260.0070.01014.17
5.6.250.0040.00814.25
5.6.240.0030.01014.13
5.6.230.0100.00314.24
5.6.220.0070.00714.17
5.6.210.0050.03017.45
5.6.200.0030.03716.23
5.6.190.0120.04217.56
5.6.180.1680.02517.29
5.6.170.0120.02617.30
5.6.160.0080.02317.29
5.6.150.0080.02816.15
5.6.140.0030.03016.28
5.6.130.0070.03416.23
5.6.120.0100.02517.71
5.6.110.0100.02817.57
5.6.100.0120.04017.64
5.6.90.0070.04317.72
5.6.80.0090.03017.54
5.6.70.0170.03517.32
5.6.60.0070.00714.07
5.6.50.0060.00614.18
5.6.40.0090.00613.82
5.6.30.0140.00014.17
5.6.20.0030.00914.13
5.6.10.0060.00314.44
5.6.00.0060.00614.04
5.5.380.0090.00011.18
5.5.370.0090.00311.18
5.5.360.0070.00011.18
5.5.350.0110.04015.78
5.5.340.0020.03214.63
5.5.330.0050.02315.93
5.5.320.0150.02315.72
5.5.310.0250.04015.69
5.5.300.0030.02514.57
5.5.290.0080.04514.57
5.5.280.0020.03716.03
5.5.270.0000.02816.06
5.5.260.0070.04116.03
5.5.250.0050.04815.95
5.5.240.0120.03715.70
5.5.230.0070.00011.18
5.5.220.0100.00011.18
5.5.210.0000.01111.18
5.5.200.0000.00611.18
5.5.190.0100.00011.18
5.5.180.0000.00811.18
5.5.170.0030.00711.18
5.5.160.0000.00611.18
5.5.150.0060.00311.18
5.5.140.0030.00711.31
5.5.130.0060.00011.18
5.5.120.0040.00711.18
5.5.110.0000.00811.18
5.5.100.0060.00311.18
5.5.90.0000.00511.28
5.5.80.0080.00411.18
5.5.70.0060.00611.18
5.5.60.0100.00311.21
5.5.50.0080.00011.18
5.5.40.0030.00611.18
5.5.30.0050.00511.18
5.5.20.0040.00411.26
5.5.10.0000.00811.18
5.5.00.0030.00611.18
5.4.450.0370.03715.33
5.4.440.0380.03315.18
5.4.430.0370.03115.44
5.4.420.0230.03215.38
5.4.410.0480.02815.27
5.4.400.0200.03814.98
5.4.390.0170.02914.98
5.4.380.0130.03014.84
5.4.370.0080.02814.86
5.4.360.0100.02614.97
5.4.350.0060.02611.61
5.4.340.0080.02011.61
5.4.330.0040.00411.18
5.4.320.0070.02211.85
5.4.310.0050.02511.85
5.4.300.0070.02011.85
5.4.290.0050.03111.85
5.4.280.0060.02411.80
5.4.270.0040.02111.80
5.4.260.0040.02511.80
5.4.250.0100.02514.91
5.4.240.0070.02815.08
5.4.230.0050.02714.96
5.4.220.0070.03015.11
5.4.210.0080.02614.97
5.4.200.0050.02814.94
5.4.190.0050.03014.90
5.4.180.0020.03114.89
5.4.170.0090.02515.05
5.4.160.0120.02315.07
5.4.150.0080.02815.01
5.4.140.0030.03113.81
5.4.130.0050.02513.84
5.4.120.0060.02813.78
5.4.110.0090.02313.81
5.4.100.0050.02913.83
5.4.90.0110.02613.78
5.4.80.0050.03013.88
5.4.70.0000.03313.75
5.4.60.0070.02713.89
5.4.50.0060.03313.77
5.4.40.0070.02813.90
5.4.30.0030.03013.79
5.4.20.0060.02613.84
5.4.10.0050.03013.80
5.4.00.0030.03113.60
5.3.290.0050.02511.99
5.3.280.0050.02912.94
5.3.270.0020.03212.82
5.3.260.0030.02812.90
5.3.250.0020.03112.95
5.3.240.0030.02913.00
5.3.230.0080.03812.91
5.3.220.0000.03412.97
5.3.210.0080.02512.88
5.3.200.0120.02712.96
5.3.190.0110.02713.00
5.3.180.0100.03612.92
5.3.170.0060.03812.92
5.3.160.0080.02612.92
5.3.150.0060.02812.88
5.3.140.0050.04312.83
5.3.130.0060.02812.89
5.3.120.0100.03512.88
5.3.110.0080.03012.92
5.3.100.0020.03212.69
5.3.90.0050.02712.65
5.3.80.0050.02812.66
5.3.70.0030.02712.62
5.3.60.0070.02712.60
5.3.50.0040.02912.61
5.3.40.0020.03212.62
5.3.30.0050.02712.64
5.3.20.0020.02812.48
5.3.10.0030.02512.44
5.3.00.0050.02712.47
5.2.170.0040.03111.17
5.2.160.0030.02111.29
5.2.150.0040.02011.27
5.2.140.0030.02611.22
5.2.130.0040.02211.19
5.2.120.0090.01711.25
5.2.110.0030.02411.16
5.2.100.0030.02211.20
5.2.90.0020.02411.11
5.2.80.0020.02311.19
5.2.70.0000.03511.19
5.2.60.0030.02411.17
5.2.50.0080.01811.16
5.2.40.0060.02011.07
5.2.30.0030.02511.14
5.2.20.0040.02211.07
5.2.10.0040.02911.07
5.2.00.0100.02311.05
5.1.60.0040.02010.71
5.1.50.0000.02210.64
5.1.40.0060.01810.61
5.1.30.0050.02010.76
5.1.20.0060.02710.77
5.1.10.0020.02010.62
5.1.00.0060.01710.47
5.0.50.0000.0179.99
5.0.40.0000.0169.80
5.0.30.0030.0239.76
5.0.20.0030.0189.63
5.0.10.0000.0199.68
5.0.00.0020.0299.67
4.4.90.0020.0158.52
4.4.80.0000.0148.50
4.4.70.0020.0138.50
4.4.60.0000.0148.49
4.4.50.0020.0148.49
4.4.40.0040.0158.54
4.4.30.0000.0148.52
4.4.20.0000.0148.54
4.4.10.0020.0158.54
4.4.00.0030.0178.52
4.3.110.0050.0108.49
4.3.100.0000.0138.49
4.3.90.0010.0118.49
4.3.80.0040.0158.49
4.3.70.0050.0158.49
4.3.60.0030.0128.50
4.3.50.0020.0138.49
4.3.40.0020.0178.49
4.3.30.0000.0158.49
4.3.20.0000.0158.49
4.3.10.0030.0128.49
4.3.00.0110.0089.38

preferences:
44.4 ms | 401 KiB | 5 Q