WordPress at Your Fingertips
function is not described

SimplePie_IRI::to_uri() public WP 1.0

Convert an IRI to a URI (or parts thereof)

{} It's a method of the class: SimplePie_IRI{}

No Hooks.

Return

String.

Usage

$SimplePie_IRI = new SimplePie_IRI();
$SimplePie_IRI->to_uri( $string );
$string (required)
-

Code of SimplePie_IRI::to_uri() WP 5.8.2

public function to_uri($string)
{
	static $non_ascii;
	if (!$non_ascii)
	{
		$non_ascii = implode('', range("\x80", "\xFF"));
	}

	$position = 0;
	$strlen = strlen($string);
	while (($position += strcspn($string, $non_ascii, $position)) < $strlen)
	{
		$string = substr_replace($string, sprintf('%%%02X', ord($string[$position])), $position, 1);
		$position += 3;
		$strlen += 2;
	}

	return $string;
}