PHP | base64_encode() Function Last Updated : 27 Apr, 2023 Comments Improve Suggest changes Like Article Like Report The base64_encode() function is an inbuilt function in PHP that is used to encode data with MIME base64. MIME (Multipurpose Internet Mail Extensions) base64 is used to encode the string in base64. The base64_encoded data takes 33% more space than the original data. Syntax: string base64_encode( $data ) Parameters: This function accepts single parameter $data which is mandatory. It is used to specify the string encoding. Return value: This function returns the encoded string in base64 on success or returns False in case of failure. The below programs illustrate the base64_encode() function in PHP. Program 1: php <?php // Program to illustrate base64_encode() // function $str = 'GeeksforGeeks'; echo base64_encode($str); ?> Output:R2Vla3Nmb3JHZWVrcw== Program 2: php <?php // Program to illustrate base64_encode() // function $str = 'GFG, A computer Science Portal For Geeks'; echo base64_encode($str). "\n"; $str = ''; echo base64_encode($str). "\n"; $str = 1; echo base64_encode($str). "\n"; $str = '@#$'; echo base64_encode($str). "\n"; ?> Output:R0ZHLCBBIGNvbXB1dGVyIFNjaWVuY2UgUG9ydGFsIEZvciBHZWVrcw== MQ== QCMk Reference: http://php.net/manual/en/function.base64-encode.php Comment More infoAdvertise with us Next Article PHP | base64_encode() Function R R_Raj Follow Improve Article Tags : Misc Web Technologies PHP PHP-function Practice Tags : Misc Similar Reads PHP | base64_decode() Function The base64_decode() is an inbuilt function in PHP which is used to Decodes data which is encoded in MIME base64.Syntax: string base64_decode( $data, $strict ) Parameters: This function accepts two parameter as mentioned above and described below: $data: It is mandatory parameter which contains the e 1 min read PHP imap_base64() Function The imap_base64() function is an inbuilt function in PHP that is used to decode the base64 encoded text. Syntax: imap_base64(string $string)Parameters: This function accepts only one parameter which is described below. $string: This is the base64 string parameter that is going to be decoded.Return V 1 min read PHP | json_encode() Function The json_encode() function is an inbuilt function in PHP which is used to convert PHP array or object into JSON representation. Syntax : string json_encode( $value, $option, $depth ) Parameters: $value: It is a mandatory parameter which defines the value to be encoded. $option: It is optional parame 2 min read PHP base_convert( ) Math Function The base_convert() function in PHP is used to convert a number given in an arbitrary base to a desired base. Both the base should be between 2 and 32 and bases with digits greater than 10 are represented with letters a-z i.e 10 is represented as a, 11 is represented as b and 35 is represented as z. 2 min read PHP | utf8_decode() Function The utf8_decode() function is an inbuilt function in PHP which is used to decode a UTF-8 string to the ISO-8859-1. This function decodes back to the encoded string which is encoded with the utf8_encode() function. Syntax: string utf8_decode( string $string ) Parameter: This function accepts single 2 min read PHP | json_decode() Function The json_decode() function is an inbuilt function in PHP which is used to decode a JSON string. It converts a JSON encoded string into a PHP variable. Syntax: json_decode( $json, $assoc = FALSE, $depth = 512, $options = 0 ) Parameters: This function accepts four parameters as mentioned above and des 2 min read PHP mb_check_encoding() Function The mb_check_encoding() function is an inbuilt function in PHP that is used to check whether a given string is valid for specified encoding or not. Syntax: bool mb_check_encoding( array|string|null $value = null, string $encoding = null ) Parameters: This function accepts two parameters that are des 2 min read PHP mb_detect_encoding() Function The mb_detect_encoding() is an inbuilt function in PHP that is used to detect the encoding of the string. Syntax: string|false mb_detect_encoding( string $string, array|string|null $encodings = null, bool $strict = false ) Parameters: This function accepts three parameters that are described below. 2 min read PHP mb_convert_encoding() Function The mb_convert_encoding() function is an inbuilt function in PHP that transforms the string into another character encoding. Syntax: mb_convert_encoding( array|string $string, string $to_encoding, array|string|null $from_encoding = null ): array|string|falseParameters: This function has 3 parameters 1 min read PHP | iconv_get_encoding() Function The iconv_get_encoding() function is an inbuilt function in PHP which is used to retrieve the internal configuration variables of iconv extension. Syntax: mixed iconv_get_encoding( $type = "all" ) Parameters: This function accepts single parameter $type. The value of $type parameter are: all input_e 1 min read Like