Home Menu

urldecode

Decodes URL-encoded string

Syntax

urldecode ( string $str ) : string

Parameters

str

The string to be decoded.

Return

Returns the decoded string.

Examples

1

<?

$str = "-_.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";

$return = urldecode($str);

echo $return;

?>
-_.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz

2

<?

$str = "%7E%21%40%23%24%25%5E%26%2A%28%29%2B%3D%7B%5B%7D%5D%7C%5C%3A%3B%22%27%3C%2C%3E%3F%2F";

$return = urldecode($str);

echo $return;

?>
~!@#$%^&*()+={[}]|\:;"'<,>?/

3

<?

$str = "+";

$return = urldecode($str);

var_export($return);

?>
' '

4

<?

$str = "decode+non-alphanumeric";

$return = urldecode($str);

echo '<a href="https://domain.com/path?var=' . $str . '">' . $return . '</a>';

?>
<a href="https://domain.com/path?var=decode+non-alphanumeric">decode non-alphanumeric</a>

Internal

rawurldecode

rawurlencode

urlencode

External

PHP

JesusBible
HTMLCSSJSPHPSVGMore
AboutTerms