PHP Multibyte String Functions
EditRocket provides the following information on Multibyte String functions in the PHP source code builder.
bool mb_check_encoding ([ string $var [, string $encoding ]] ) - mb_check_encoding() checks if the specified byte stream is valid for the specified encoding. It is useful to prevent so-called Invalid Encoding Attack.
string mb_convert_case ( string $str , int $mode [, string $encoding ] ) - mb_convert_case() returns case folded version of string converted in the way specified by mode.
string mb_convert_encoding ( string $str , string $to_encoding [, mixed $from_encoding ] ) - mb_convert_encoding() converts character encoding of string str from from_encoding to to_encoding.
string mb_convert_kana ( string $str [, string $option [, string $encoding ]] ) - mb_convert_kana() performs han-kaku - zen-kaku conversion for string str. It returns converted string. This function is only useful for Japanese.
string mb_convert_variables ( string $to_encoding , mixed $from_encoding , mixed &$vars [, mixed &$... ] ) - mb_convert_variables() convert character encoding of variables vars in encoding from_encoding to encoding to_encoding. It returns character encoding before conversion for success, FALSE for failure.
string mb_decode_mimeheader ( string $str ) - mb_decode_mimeheader() decodes encoded-word string str in MIME header.
string mb_decode_numericentity ( string $str , array $convmap [, string $encoding ] ) - Convert numeric string reference of string str in specified block to character. It returns converted string.
string mb_detect_encoding ( string $str [, mixed $encoding_list [, bool $strict ]] ) - mb_detect_encoding() detects character encoding in string str. It returns detected character encoding.
mixed mb_detect_order ([ mixed $encoding_list ] ) - mb_detect_order() sets automatic character encoding detection order to encoding_list. It returns TRUE for success, FALSE for failure.
string mb_encode_mimeheader ( string $str [, string $charset [, string $transfer_encoding [, string $linefeed [, int $indent ]]]] ) - mb_encode_mimeheader() encodes a given string str by the MIME header encoding scheme. Returns a converted version of the string represented in ASCII.
string mb_encode_numericentity ( string $str , array $convmap [, string $encoding ] ) - mb_encode_numericentity() converts specified character codes in string str from HTML numeric character reference to character code. It returns converted string.
int mb_ereg ( string $pattern , string $string [, array $regs ] ) -
bool mb_ereg_match ( string $pattern , string $string [, string $option ] ) -
string mb_ereg_replace ( string $pattern , string $replacement , string $string [, string $option ] ) -
bool mb_ereg_search ([ string $pattern [, string $option ]] ) -
int mb_ereg_search_getpos ( void ) -
array mb_ereg_search_getregs ( void ) -
bool mb_ereg_search_init ( string $string [, string $pattern [, string $option ]] ) -
array mb_ereg_search_pos ([ string $pattern [, string $option ]] ) -
array mb_ereg_search_regs ([ string $pattern [, string $option ]] ) -
bool mb_ereg_search_setpos ( int $position ) -
int mb_eregi ( string $pattern , string $string [, array $regs ] ) -
string mb_eregi_replace ( string $pattern , string $replace , string $string [, string $option ] ) -
mixed mb_get_info ([ string $type ] ) - If type isn't specified or is specified to all, an array having the elements internal_encoding, http_output, http_input, func_overload, mail_charset, mail_header_encoding, mail_body_encoding will be returned. The last three elements are available since PHP 5.1.3.
mixed mb_http_input ([ string $type ] ) - type: Input string specifies input type.
mixed mb_http_output ([ string $encoding ] ) - If encoding is set, mb_http_output() sets HTTP output character encoding to encoding. Output after this function is converted to encoding. mb_http_output() returns TRUE for success and FALSE for failure.
mixed mb_internal_encoding ([ string $encoding ] ) - mb_internal_encoding() sets internal character encoding to encoding If parameter is omitted, it returns current internal encoding.
mixed mb_language ([ string $language ] ) - mb_language() sets language. If language is omitted, it returns current language as string.
string mb_output_handler ( string $contents , int $status ) -
bool mb_parse_str ( string $encoded_string [, array &$result ] ) - mb_parse_str() parses GET/POST/COOKIE data and sets global variables. Since PHP does not provide raw POST/COOKIE data, it can only used for GET data for now. It preses URL encoded data, detects encoding, converts coding to internal encoding and set values to result array or global variables.
string mb_preferred_mime_name ( string $encoding ) - mb_preferred_mime_name() returns MIME charset string for character encoding encoding. It returns charset string.
mixed mb_regex_encoding ([ string $encoding ] ) - If the optional parameter encoding is specified, it is set to the character encoding for multibyte regex. The default value is the internal character encoding.
string mb_regex_set_options ([ string $options ] ) - Returns the previous options. If options is omitted, it returns the string that describes the current options.
bool mb_send_mail ( string $to , string $subject , string $message [, string $additional_headers [, string $additional_parameter ]] ) - mb_send_mail() sends email.
array mb_split ( string $pattern , string $string [, int $limit ] ) -
string mb_strcut ( string $str , int $start [, int $length [, string $encoding ]] ) - mb_strcut() returns the portion of str specified by the start and length parameters.
string mb_strimwidth ( string $str , int $start , int $width [, string $trimmarker [, string $encoding ]] ) - mb_strimwidth() truncates string str to specified width. It returns truncated string.
int mb_stripos ( string $haystack , string $needle [, int $offset [, string $encoding ]] ) - mb_stripos() returns the numeric position of the first occurrence of needle in the haystack string.
string mb_stristr ( string $haystack , string $needle [, bool $part [, string $encoding ]] ) - mb_stristr() finds the first occurrence of needle in haystack and returns the portion of haystack.
int mb_strlen ( string $str [, string $encoding ] ) - mb_strlen() returns number of characters in string str having character encoding encoding. A multi-byte character is counted as 1.
int mb_strpos ( string $haystack , string $needle [, int $offset [, string $encoding ]] ) - mb_strpos() returns the numeric position of the first occurrence of needle in the haystack string. If needle is not found, it returns FALSE.
string mb_strrchr ( string $haystack , string $needle [, bool $part [, string $encoding ]] ) - mb_strrchr() finds the last occurrence of needle in haystack and returns the portion of haystack. If needle is not found, it returns FALSE.
string mb_strrichr ( string $haystack , string $needle [, bool $part [, string $encoding ]] ) - mb_strrichr() finds the last occurrence of needle in haystack and returns the portion of haystack.
int mb_strripos ( string $haystack , string $needle [, int $offset [, string $encoding ]] ) -
int mb_strrpos ( string $haystack , string $needle [, int $offset [, string $encoding ]] ) - mb_strrpos() returns the numeric position of the last occurrence of needle in the haystack string. If needle is not found, it returns FALSE.
string mb_strstr ( string $haystack , string $needle [, bool $part [, string $encoding ]] ) - mb_strstr() finds the first occurrence of needle in haystack and returns the portion of haystack. If needle is not found, it returns FALSE.
string mb_strtolower ( string $str [, string $encoding ] ) - mb_strtolower() returns str with all alphabetic characters converted to lowercase.
string mb_strtoupper ( string $str [, string $encoding ] ) - mb_strtoupper() returns str with all alphabetic characters converted to uppercase.
int mb_strwidth ( string $str [, string $encoding ] ) - mb_strwidth() returns width of string str.
mixed mb_substitute_character ([ mixed $substrchar ] ) - mb_substitute_character() specifies substitution character when input character encoding is invalid or character code is not exist in output character encoding. Invalid characters may be substituted NULL(no output), string or integer value (Unicode character code value).
string mb_substr ( string $str , int $start [, int $length [, string $encoding ]] ) - mb_substr() returns the portion of str specified by the start and length parameters.
int mb_substr_count ( string $haystack , string $needle [, string $encoding ] ) - mb_substr_count() returns the number of times the needle substring occurs in the haystack string.