Try this:
base64_decode — Decodes data encoded with MIME base64
PHP: base64_decode - Manual
Usage:
string base64_decode ( string $data [, bool $strict= false ] )
data - The encoded data.
strict - Returns FALSE if input contains character from outside the base64 alphabet.
You might also use this regular expression:
^[a-zA-Z0-9/+]*={0,2}$
Which will also detect the usage of = or == at the end of the string (and only end). A function geared specifically toward this: