decode_url

Decode URL-encoded strings

Definition

string decode_url(string $string)

Transforms a URL-encoded string to a UTF-8 decoded string. If $string is not URL-encoded, there will be no change.

Parameters

string $string

String to decode.

Returns

string

If $string was URL-encoded, returns the decoded version of it. If not, returns $string.

Examples

{
  "ChineseEncoded": "%E6%88%91%E5%96%9C%E6%AC%A2%E4%BD%BF%E7%94%A8%E6%96%87%E6%A1%A3%E9%A9%AC%E8%BE%BE",
  "Chinese": "我喜欢使用文档马达",
  "DanishEncoded": "Bl%C3%A5b%C3%A6r%20og%20blomk%C3%A5l",
  "Danish": "Blåbær og blomkål"
}
{
  chineseEncoded: decode_url(ChineseEncoded),
  chinese: decode_url(Chinese),
  danishEncoded: decode_url(DanishEncoded),
  danish: decode_url(Danish)
}
{
  "chineseEncoded": "我喜欢使用文档马达",
  "chinese": "我喜欢使用文档马达",
  "danishEncoded": "Blåbær og blomkål",
  "danish": "Blåbær og blomkål"
}