The urldecode() function is an inbuilt function in PHP which is used to decode url which is encoded by encoded() function.
Syntax:
string urldecode( $input )
Parameters: This function accepts single parameter $input which holds the url to be decoded.
Return Value: This function returns the decoded string on success.
Below programs illustrate the urldecode() function in PHP:
Program 1:
<?php // PHP program to illustrate urldecode function // all sub domain of geeksforgeeks echo urldecode("https%3A%2F%2Fide.geeksforgeeks.org%2F"). "\n"; echo urldecode("https%3A%2F%2Fpractice.geeksforgeeks.org%2F"). "\n"; echo urldecode("https%3A%2F%2Fgeeksforgeeks.org%2F"). "\n"; ?> |
https://ide.geeksforgeeks.org/ https://practice.geeksforgeeks.org/ https://geeksforgeeks.org/
Program 2 :
<?php // all sub domain of geeksforgeeks $url1 = "https%3A%2F%2Fide.geeksforgeeks.org%2F"; $url2 = "https%3A%2F%2Fpractice.geeksforgeeks.org%2F"; $url3 = "https%3A%2F%2Fgeeksforgeeks.org%2F"; // create an array $query = array($url1, $url2, $url3); // print decoded url foreach ($query as $chunk) { printf(urldecode($chunk). "\n"); } ?> |
https://ide.geeksforgeeks.org/ https://practice.geeksforgeeks.org/ https://geeksforgeeks.org/
Reference: http://php.net/manual/en/function.urldecode.php
Recommended Posts:
- How to get the function name inside a function in PHP ?
- PHP 5 vs PHP 7
- PHP | Get PHP configuration information using phpinfo()
- PHP | php.ini File Configuration
- How to import config.php file in a PHP script ?
- PHP | imagecreatetruecolor() Function
- PHP | fpassthru( ) Function
- PHP | ImagickDraw getTextAlignment() Function
- PHP | Ds\Sequence last() Function
- PHP | Imagick floodFillPaintImage() Function
- Function to escape regex patterns before applied in PHP
- PHP | array_udiff_uassoc() Function
- PHP | geoip_continent_code_by_name() Function
- PHP | GmagickPixel setcolor() function
- PHP | opendir() Function
- PHP | cal_to_jd() Function
- PHP | stream_get_transports() Function
- PHP | Ds\Deque pop() Function
- PHP | SimpleXMLElement children() Function
- PHP | array_intersect_ukey() Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.
Improved By : nidhi_biet

