php base64_encode Examples : The base64_encode() function in PHP encodes data with MIME base64. base64 encoded data consumes 33% more space. Means encoded data is 33% larger than original data.
php base64_encode
There are the following the list of “php base64 encode”.
php base64_encode – Supported Versions:
- PHP 4
- PHP 5
- PHP 7
PHP base64_encode() Syntax
base64_encode ( string $string )
string $string | required : string value to be encoded.
Return Value : base64 encoded string return करता है।
PHP base64_encode() Example
//Result V2VsY29tZSBUbyBQYWthaW5mby5jb20gIQ==
The base64_decode() function is used to decode a base64 encoded string.
How to convert an image to Base64 encoding?
$path = 'rajkot/loveshop.png'; $type = pathinfo($path, PATHINFO_EXTENSION); $data = file_get_contents($path); $base64 = 'data:image/' . $type . ';base64,' . base64_encode($data);
base64_encode
base64_encode ( string $string ) : string
base64_decode
base64_decode ( string $string , bool $strict = false ) : string|false
@ref : https://www.php.net/manual/en/function.base64-encode.php
store the result in a variable and check for errors
"V2VsY29tZSBUbyBQYWthaW5mby5jb20gIQ==" }