rawurlencode

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
URL-encode according to RFC 3986
<?php rawurlencode(string $string): string
<?php         $args = array();

        \parse_str(isset($parts['query']) ? $parts['query'] : '', $args);

        if ($host !== $ip && !isset($args['hostname'])) {

            $uri .= (isset($parts['query']) ? '&' : '?') . 'hostname=' . \rawurlencode($host);

        }