base64_decode
Description
The base64_decode of URL for PHP decodes data encoded with MIME base64.
Syntax
base64_decode( string $string, bool $strict = false ): string|false
Parameters
string
The encoded data.
strict
If the strict parameter is set to true then the base64_decode() function will return false if the input contains character from outside the base64 alphabet. Otherwise invalid characters will be silently discarded.
Return
Returns the decoded data or false on failure. The returned data may be binary.
Examples
1 · string
<? $string = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw=='; $return = base64_decode($string); var_export($return);
'This is an encoded string'
2 · strict · false
<? $string = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==' . '#'; $strict = false; $return = base64_decode($string, $strict); var_export($return);
'This is an encoded string'
3 · strict · true
<? $string = 'VGhpcyBpcyBhbiBlbmNvZGVkIHN0cmluZw==' . '#'; $strict = true; $return = base64_decode($string, $strict); var_export($return);
false