URL Decoding in PHP

PHPServer Side ProgrammingProgramming

URL decoding can be done using the built-in 'urldecode' function. This returns the encoded data.

Syntax of urldecode function

string urldecode($input)

It takes a single parameter ($input) which is the URL that is to be decoded. Returns the decoded string provided the decoding was successful −

Example

 Live Demo

<?php
   echo urldecode("https%3A%2F%2Fmedium.com%2F"). "\n";
?> 

In the above lines of the code, the ‘urldecode’ function takes in the raw (encoded string) and returns the decoded value of the string.

Output

This will produce the following output −

https://medium.com/
raja
Published on 07-Apr-2020 11:44:43
Advertisements