Skip to content
Home » Blog » Encode and decode URL

Encode and decode URL

In PHP you can send values by encoding and decoding the URL by using this encoding and decoding method.
{code type=PHP}echo base64_encode(‘I am encoded PHP’);{/code}
You will get and output something like this.
{code type=PHP}VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=={/code}

This can be decoded by using

{code type=PHP}echo base64_decode(‘VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==’);{/code}

Output:
{code type=PHP}I am encoded PHP{/code}

When ever you want to send some data via URL you can use this function to encode and decode.

Leave a Reply

Your email address will not be published. Required fields are marked *