Saturday

What is URLencode and URLdecode?

Definition 1:
urlencode() returns the URL encoded version of the given string.
URL coding converts special characters into % signs followed by two hex digits.


For example: urlencode("10.00%") will return "10%2E00%25".

URL encoded strings are safe to be used as part of URLs.
urldecode() returns the URL decoded version of the given string.

Definition 2:
string urlencode(str) - Returns the URL encoded version of the input string.
String values to be used in URL query string need to be URL encoded.

In the URL encoded version:

Alphanumeric characters are maintained as is.
Space characters are converted to "+" characters.
Other non-alphanumeric characters are converted "%" followed by two hex digits representing the converted character.

string urldecode(str) - Returns the original string of the input URL encoded string.

For example:

$discount ="10.00%";
$url = "http://domain.com/submit.php?disc=".urlencode($discount);
echo $url;

You will get "http://domain.com/submit.php?disc=10%2E00%25".

URL encoder will make youe wen\bsite more secure which in term, improves your website quality.

No comments:

Providing tips to improve website quality, website speed, website design and website performance is the main objective of this blog. Improving website quality and website performance increases website traffic and page rank. Details on Web technologies, Quality website design, SEO concepts, Developer guides, and website related in IT industry.