Convert a String From a URL-friendly Format to a Regular String in PHP With Example

How to convert a string from a URL-friendly format (URL encoded) to a regular string in PHP, you can use the `urldecode()` function. This function decodes URL-encoded strings. Here’s an example:

$urlEncodedString = "Hello%20World%21%20This%20is%20a%20URL%20encoded%20string%2E";
$decodedString = urldecode($urlEncodedString);
echo $decodedString;


Hello World! This is a URL encoded string.

In this example, the URL-encoded string `”Hello%20World%21%20This%20is%20a%20URL%20encoded%20string%2E”` is decoded using `urldecode()`, resulting in the regular string `”Hello World! This is a URL encoded string.”`