Utilize the online apparatus to either encode or decode a line of text. Just enter your information at that point press the encode or decode button.
The urlencode() function is an inbuilt function in PHP which is used to encode the url. This function returns a string in which all non-alphanumeric characters except -_. have been replaced with a percent (%) sign followed by two hex digits and spaces encoded as plus (+) signs.
Why do we need URL Encoding
The URL specifies only a small set of characters that can be used in a URL.
A to Z (ABCDEFGHIJKLMNOPQRSTUVWXYZ), a to z (abcdefghijklmnopqrstuvwxyz), 0 to 9 (0123456789), $ (Dollar sign), - (Dash), _ (Underscore), + (Plus sign), ! (Exclamation), * (Star), ' (Single quote), ( (Open bracket), ) (Closing bracket)
How the URL Encoding work
- $ becomes %24
- & becomes %26
- + becomes %2B
- , becomes %2C
- : becomes %3A
- ; becomes %3B
- = becomes %3D
- ? becomes %3F
- @ becomes %40
The syntax for the url Encode is following.
- $string: It specifies the string to be encoded
Let's see the following example for URL Encryption
The above example will give output :