php8.5
Home/ Manual/ whatwg / url/ Uri\WhatWg\Url::toAsciiString

Uri\WhatWg\Url::toAsciiString

PHP function Edit on GitHub ✎

(PHP 8 >= 8.5.0)

Recompose the URL as an ASCII String

Description

Uri\WhatWg\Url::toAsciiString(): string

Recomposes the URL as an ASCII String, using punycode transcription instead of Unicode characters in the host component.

Parameters Parameters

Return Values

Returns the recomposed URL as an ASCII String.

Examples

Uri\WhatWg\Url::toAsciiString basic example

php
<?php
$url = new \Uri\WhatWg\Url("https://example.com/foo/bar?baz");

echo $url->toAsciiString();
?>

The above example will output:

output
https://example.com/foo/bar?baz

See Also

  • Uri\WhatWg\Url::toUnicodeString
  • Uri\Rfc3986\Uri::toRawString
  • Uri\Rfc3986\Uri::toString

Source: reference/uri/uri/whatwg/url/toasciistring.xml · from the official PHP manual (php/doc-en)