Thursday, June 27, 2013

(Uniform Resource Locator ) urlencode & urldecode in php

urlencode & urldecode in php

urlencode  — This function returns the string output

URL is converted into a valid ASCII format.
URL Encoding space is replaced by %20

Example
urlencode('Hello milind') return output ==>> Hello%20milind 

another example
urlencode('http://www.mywebsite.com/index.php?name=milind chaudhari&id=25');

Output is http://www.mywebsite.com/index.php?name=milind%20chaudhari&id=25


urldecode  — This function returns the string output
Decodes URL-encoded string

Returns the decoded string.

Example
urldecode('http://www.mywebsite.com/index.php?name=milind%20chaudhari&id=25');

Output
http://www.mywebsite.com/index.php?name=milind chaudhari&id=25

No comments: