decode_url

Modified on Thu, 9 Jul at 10:49 AM

decode_url

TABLE OF CONTENTS

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

Sample data
{
  "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"
}
Transformation
{
  chineseEncoded: decode_url(ChineseEncoded),
  chinese: decode_url(Chinese),
  danishEncoded: decode_url(DanishEncoded),
  danish: decode_url(Danish)
}
Result
{
  "chineseEncoded": "我喜欢使用文档马达",
  "chinese": "我喜欢使用文档马达",
  "danishEncoded": "Blåbær og blomkål",
  "danish": "Blåbær og blomkål"
}

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article