Encode a hostname using Punycode
Parameters
$hostname
string|WpOrgRequestsStringablerequired- Hostname
Source
public static function encode($hostname) {
if (InputValidator::is_string_or_stringable($hostname) === false) {
throw InvalidArgument::create(1, '$hostname', 'string|Stringable', gettype($hostname));
}
$parts = explode('.', $hostname);
foreach ($parts as &$part) {
$part = self::to_ascii($part);
}
return implode('.', $parts);
}
User Contributed Notes
You must log in before being able to contribute a note or feedback.