WpOrg\Requests
IdnaEncoder::encode()
Encode a hostname using Punycode
Method of the class: IdnaEncoder{}
No Hooks.
Return
String
. Punycode-encoded hostname
Usage
$result = IdnaEncoder::encode( $hostname );
- $hostname(string|Stringable) (required)
- Hostname
IdnaEncoder::encode() IdnaEncoder::encode code WP 6.6.2
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); }