Posts marked with "Encode" in tags

Preventing double encode of URL in PHP

There is no practical way to check whether an URL is encoded or not to encode if it’s not encoded. But you can do encode the URL by first decoding like below:

$string = url_decode($url);

And then you should encode as to prevent double encoding.

$string = url_encode($url);

By doing this we can prevent double encoding of URL‘s.

... [READ MORE]

Encode/Decode URL in Javascript and PHP

URL encoding and decoding can be done in both Javascript and PHP. In this post I’m going to tell you the functions used in both languages for url encoding/decoding.
Javascript
 Encoding

encodeURIComponent(url);

Decoding

decodeURIComponent(url);

PHP
 Encoding

urlencode(url);

Decoding

... [READ MORE]

Follow/Subscribe

Telegram 

Mastodon  Twitter

GitHub GitLab

Subdomains

Demos  Lab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab