urldecode
Description
Syntax
urldecode( string $string ): string
Parameters
string
The string to be decoded.
Return
Returns the decoded string.
Examples
1 · alphanumeric
<? $string = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; $return = urldecode($string); echo $return;
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
2 · non-alphanumeric · not replaced
<? $string = "-_."; $return = urldecode($string); echo $return;
-_.
3 · non-alphanumeric · replaced · %
<? $string = "%7E%60%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($string); echo $return;
~`!@#$%^&*()+={[}]|\:;"'<,>?/
4 · non-alphanumeric · replaced · +
<? $string = "+"; $return = urldecode($string); var_export($return);
' '
5 · url
<? $string = "url+to+be+decoded"; $return = urldecode($string); echo '<a href="https://osbo.com?arg=' . $string . '">' . $return . '</a>';
<a href="https://osbo.com?arg=url+to+be+decoded">url to be decoded</a>