-2

Why base64 ends with == ? Sometimes it ends with == in random characters.

I want to know how to remove those == or = from random characters. Which is the best and right way to remove these = from random characters?

Is this the best way to remove these == ?

str_replace("=","",$url)
Karuppiah RK
  • 3,894
  • 9
  • 40
  • 80

1 Answers1

2

from Wikipedia

An additional pad character is allocated which may be used to force the encoded output into an integer multiple of 4 characters (or equivalently when the unencoded binary text is not a multiple of 3 bytes) ; these padding characters must then be discarded when decoding but still allow the calculation of the effective length of the unencoded text, when its input binary length would not be a multiple of 3 bytes (the last non-pad character is normally encoded so that the last 6-bit block it represents will be zero-padded on its least significant bits, at most two pad characters may occur at the end of the encoded stream).