= PHP_4_4_3, PHP_5 >= PHP_5_1_3, PHP_7, PHP_8 // OFFLINE | mb_chr() - PHP_7 >= PHP_7_2_0, PHP_8 // mb_convert_case() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // mb_convert_encoding() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_convert_kana() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_convert_variables() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_decode_mimeheader() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_decode_numericentity() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_detect_encoding() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_detect_order() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_encode_mimeheader() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_encode_numericentity() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // OFFLINE | mb_encoding_aliases() - PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // mb_ereg_match() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // OFFLINE | mb_ereg_replace_callback() - PHP_5 >= PHP_5_4_1, PHP_7, PHP_8 // mb_ereg_replace() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_ereg_search_getpos() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_ereg_search_getregs() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_ereg_search_init() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_ereg_search_pos() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_ereg_search_regs() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_ereg_search_setpos() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_ereg_search() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_ereg() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_eregi_replace() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_eregi() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_get_info() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_http_input() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_http_output() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_internal_encoding() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_language() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // OFFLINE | mb_list_encodings() - PHP_5, PHP_7, PHP_8 // OFFLINE | mb_ord() - PHP_7 >= PHP_7_2_0, PHP_8 // mb_output_handler() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_parse_str() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_preferred_mime_name() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_regex_encoding() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // mb_regex_set_options() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // OFFLINE | mb_scrub() - PHP_7 >= PHP_7_2_0, PHP_8 // mb_send_mail() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_split() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // OFFLINE | mb_str_pad() - PHP_8 >= PHP_8_3_0 // OFFLINE | mb_str_split() - PHP_7 >= PHP_7_4_0, PHP_8 // mb_strcut() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_strimwidth() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // OFFLINE | mb_stripos() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // OFFLINE | mb_stristr() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // mb_strlen() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_strpos() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // OFFLINE | mb_strrchr() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // OFFLINE | mb_strrichr() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // OFFLINE | mb_strripos() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // mb_strrpos() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // OFFLINE | mb_strstr() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // mb_strtolower() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // mb_strtoupper() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // mb_strwidth() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_substitute_character() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // mb_substr_count() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // mb_substr() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== USING CLASSES (0) // ============================== USING DATA_TYPES (8) // bool // array // string // null // false // int // mixed // callable // ============================== END // REQUIREMENTS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING // ============================== ABOUT // PHP Manual / Function Reference / Human Language and Character Encoding Support / Multibyte String // URL: https://www.php.net/manual/en/book.mbstring.php // ============================== DESCRIPTION // MULTIBYTE_STRING // // MULTIBYTE_STRING - BEGIN // Multibyte String // // INTRODUCTION // INSTALLING_CONFIGURING // PREDEFINED_CONSTANTS // SUMMARIES_OF_SUPPORTED_ENCODINGS // BASICS_OF_JAPANESE_MULTI_BYTE_ENCODINGS // HTTP_INPUT_AND_OUTPUT // SUPPORTED_CHARACTER_ENCODINGS // FUNCTION_OVERLOADING_FEATURE // PHP_CHARACTER_ENCODING_REQUIREMENTS // MULTIBYTE_STRING_FUNCTIONS // // INTRODUCTION - BEGIN // Introduction // // While there are many languages in which every necessary character can be represented by a one-to-one mapping to an 8-bit value, there are also several languages which require so many characters for written communication that they cannot be contained within the range a mere byte can code (A byte is made up of eight bits. Each bit can contain only two distinct values, one or zero. Because of this, a byte can only represent 256 unique values (two to the power of eight)). Multibyte character encoding schemes were developed to express more than 256 characters in the regular bytewise coding system. // When you manipulate (trim, split, splice, etc.) strings encoded in a multibyte encoding, you need to use special functions since two or more consecutive bytes may represent a single character in such encoding schemes. Otherwise, if you apply a non-multibyte-aware string function to the string, it probably fails to detect the beginning or ending of the multibyte character and ends up with a corrupted garbage string that most likely loses its original meaning. // mbstring provides multibyte specific string functions that help you deal with multibyte encodings in PHP. In addition to that, mbstring handles character encoding conversion between the possible encoding pairs. mbstring is designed to handle Unicode-based encodings such as UTF-8 and UCS-2 and many single-byte encodings for convenience (listed in Supported Character Encodings). // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/intro.mbstring.php // INTRODUCTION - END // // INSTALLING_CONFIGURING - BEGIN // Installing/Configuring // // REQUIREMENTS // INSTALLATION // RUNTIME_CONFIGURATION // RESOURCE_TYPES // // REQUIREMENTS - BEGIN // Requirements // // No external libraries are needed to build this extension. // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.requirements.php // REQUIREMENTS - END // // INSTALLATION - BEGIN // Installation // // mbstring is a non-default extension. This means it is not enabled by default. You must explicitly enable the module with the configure option. See the Install section for details. // The following configure options are related to the mbstring module. // * --enable-mbstring: Enable mbstring functions. This option is required to use mbstring functions. // libmbfl is necessary for mbstring. libmbfl is bundled with mbstring. Prior to PHP 7.3.0, if libmbfl is already installed on the system, --with-libmbfl[=DIR] can be specified to use the installed library. // * --disable-mbregex: Disable regular expression functions with multibyte character support. // Oniguruma is necessary for the regular expression functions with multibyte character support. As of PHP 7.4.0, pkg-config is used to detect the libonig library. Prior to PHP 7.4.0, Oniguruma was bundled with mbstring, but it was possible to build against an already installed libonig by passing --with-onig[=DIR]. // It is possible to disable the multibyte regex backtrack check by specifying --disable-mbregex-backtrack. // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.installation.php // INSTALLATION - END // // RUNTIME_CONFIGURATION - BEGIN // Runtime Configuration // // The behaviour of these functions is affected by settings in php.ini. // // mbstring configuration options // Name | Default | Changeable | Changelog // mbstring.language | "neutral" | PHP_INI_ALL | // mbstring.detect_order | NULL | PHP_INI_ALL | // mbstring.http_input | "pass" | PHP_INI_ALL | Deprecated // mbstring.http_output | "pass" | PHP_INI_ALL | Deprecated // mbstring.internal_encoding | NULL | PHP_INI_ALL | Deprecated // mbstring.substitute_character | NULL | PHP_INI_ALL | // mbstring.func_overload | "0" | PHP_INI_SYSTEM | Deprecated as of PHP 7.2.0; removed as of PHP 8.0.0. // mbstring.encoding_translation | "0" | PHP_INI_PERDIR | // mbstring.http_output_conv_mimetypes | "^(text/|application/xhtml\+xml)" | PHP_INI_ALL | // mbstring.strict_detection | "0" | PHP_INI_ALL | // mbstring.regex_retry_limit | "1000000" | PHP_INI_ALL | Available as of PHP 7.4.0. // mbstring.regex_stack_limit | "100000" | PHP_INI_ALL | Available as of PHP 7.3.5. // // For further details and definitions of the PHP_INI_* modes, see the Where a configuration setting may be set. // Here's a short explanation of the configuration directives. // // mbstring.language string - The default national language setting (NLS) used in mbstring. Note that this option automagically defines mbstring.internal_encoding and mbstring.internal_encoding should be placed after mbstring.language in php.ini // mbstring.encoding_translation bool - Enables the transparent character encoding filter for the incoming HTTP queries, which performs detection and conversion of the input encoding to the internal character encoding. // mbstring.internal_encoding string - Warning: This deprecated feature will certainly be removed in the future. // Defines the default internal character encoding. // Users should leave this empty and set default_charset instead. // mbstring.http_input string - Warning: This deprecated feature will certainly be removed in the future. // Defines the default HTTP input character encoding. // Users should leave this empty and set default_charset instead. // mbstring.http_output string - Warning: This deprecated feature will certainly be removed in the future. // Defines the default HTTP output character encoding (output will be converted from the internal encoding to the HTTP output encoding upon output). // Users should leave this empty and set default_charset instead. // mbstring.detect_order string - Defines default character code detection order. See also mb_detect_order(). // mbstring.substitute_character string - Defines character to substitute for invalid character encoding. See mb_substitute_character() for supported values. // mbstring.func_overload string - Warning: This feature has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0. Relying on this feature is highly discouraged. // Overloads a set of single byte functions by the mbstring counterparts. See Function overloading for more information. // This setting can only be changed from the php.ini file. // mbstring.http_output_conv_mimetypes string - // mbstring.strict_detection bool - Enables strict encoding detection. See mb_detect_encoding() for a description and examples. // mbstring.regex_retry_limit int - Limits the amount of backtracking that may be performed during one mbregex match. // This setting only takes effect when linking against oniguruma >= 6.8.0. // mbstring.regex_stack_limit int - Limits the stack depth of mbstring regular expressions. // // According to the > HTML 4.01 specification, Web browsers are allowed to encode a form being submitted with a character encoding different from the one used for the page. See mb_http_input() to detect character encoding used by browsers. // Although popular browsers are capable of giving a reasonably accurate guess to the character encoding of a given HTML document, it would be better to set the charset parameter in the Content-Type HTTP header to the appropriate value by header() or default_charset ini setting. // // [example] // Example #1 php.ini setting examples // [code] // ; Set default language // mbstring.language = Neutral; Set default language to Neutral(UTF-8) (default) // mbstring.language = English; Set default language to English // mbstring.language = Japanese; Set default language to Japanese // // ;; Set default internal encoding // ;; Note: Make sure to use character encoding works with PHP // mbstring.internal_encoding = UTF-8 ; Set internal encoding to UTF-8 // // ;; HTTP input encoding translation is enabled. // mbstring.encoding_translation = On // // ;; Set default HTTP input character encoding // ;; Note: Script cannot change http_input setting. // mbstring.http_input = pass ; No conversion. // mbstring.http_input = auto ; Set HTTP input to auto // ; "auto" is expanded according to mbstring.language // mbstring.http_input = SJIS ; Set HTTP input to SJIS // mbstring.http_input = UTF-8,SJIS,EUC-JP ; Specify order // // ;; Set default HTTP output character encoding // mbstring.http_output = pass ; No conversion // mbstring.http_output = UTF-8 ; Set HTTP output encoding to UTF-8 // // ;; Set default character encoding detection order // mbstring.detect_order = auto ; Set detect order to auto // mbstring.detect_order = ASCII,JIS,UTF-8,SJIS,EUC-JP ; Specify order // // ;; Set default substitute character // mbstring.substitute_character = 12307 ; Specify Unicode value // mbstring.substitute_character = none ; Do not print character // mbstring.substitute_character = long ; Long Example: U+3000,JIS+7E7E // [/code] // [/example] // [example] // Example #2 php.ini setting for EUC-JP users // [code] // ;; Disable Output Buffering // output_buffering = Off // // ;; Set HTTP header charset // default_charset = EUC-JP // // ;; Set default language to Japanese // mbstring.language = Japanese // // ;; HTTP input encoding translation is enabled. // mbstring.encoding_translation = On // // ;; Set HTTP input encoding conversion to auto // mbstring.http_input = auto // // ;; Convert HTTP output to EUC-JP // mbstring.http_output = EUC-JP // // ;; Set internal encoding to EUC-JP // mbstring.internal_encoding = EUC-JP // // ;; Do not print invalid characters // mbstring.substitute_character = none // [/code] // [/example] // [example] // Example #3 php.ini setting for SJIS users // [code] // ;; Enable Output Buffering // output_buffering = On // // ;; Set mb_output_handler to enable output conversion // output_handler = mb_output_handler // // ;; Set HTTP header charset // default_charset = Shift_JIS // // ;; Set default language to Japanese // mbstring.language = Japanese // // ;; Set http input encoding conversion to auto // mbstring.http_input = auto // // ;; Convert to SJIS // mbstring.http_output = SJIS // // ;; Set internal encoding to EUC-JP // mbstring.internal_encoding = EUC-JP // // ;; Do not print invalid characters // mbstring.substitute_character = none // [/code] // [/example] // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.configuration.php // RUNTIME_CONFIGURATION - END // // RESOURCE_TYPES - BEGIN // Resource Types // // This extension has no resource types defined. // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.resources.php // RESOURCE_TYPES - END // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.setup.php // INSTALLING_CONFIGURING - END // // PREDEFINED_CONSTANTS - BEGIN // Predefined Constants // // The constants below are defined by this extension, and will only be available when the extension has either been compiled into PHP or dynamically loaded at runtime. // // MB_OVERLOAD_MAIL (int) - Removed as of PHP 8.0.0. // MB_OVERLOAD_STRING (int) - Removed as of PHP 8.0.0. // MB_OVERLOAD_REGEX (int) - Removed as of PHP 8.0.0. // MB_CASE_UPPER (int) - Performs a full upper-case folding. This may change the length of the string. This is the mode used by mb_strtoupper(). // MB_CASE_LOWER (int) - Performs a full lower-case folding. This may change the length of the string. This is the mode used by mb_strtolower(). // MB_CASE_TITLE (int) - Performs a full title-case conversion based on the Cased and CaseIgnorable derived Unicode properties. In particular this improves handling of quotes and apostrophes. This may change the length of the string. // MB_CASE_FOLD (int) - Performs a full case fold conversion which removes case distinctions present in the string. This is used for caseless matching. This may change the length of the string. Available since PHP 7.3. // MB_CASE_LOWER_SIMPLE (int) - Performs a simple lower-case fold conversion. This does not change the length of the string. Available as of PHP 7.3. // MB_CASE_UPPER_SIMPLE (int) - Performs simple upper-case fold conversion. This does not change the length of the string. Available as of PHP 7.3. // MB_CASE_TITLE_SIMPLE (int) - Performs simple title-case fold conversion. This does not change the length of the string. Available as of PHP 7.3. // MB_CASE_FOLD_SIMPLE (int) - Performs a simple case fold conversion which removes case distinctions present in the string. This is used for caseless matching. This does not change the length of the string. Used by case-insensitive operations internally by the MBString extension. Available as of PHP 7.3. // MB_ONIGURUMA_VERSION (string) - The Oniguruma version, e.g. 6.9.4. Available as of PHP 7.4. // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.constants.php // PREDEFINED_CONSTANTS - END // // SUMMARIES_OF_SUPPORTED_ENCODINGS - BEGIN // Summaries of supported encodings // // Summaries of supported encodings // Name in the IANA character set registry ; Underlying character set - Description ; Additional note // ISO-10646-UCS-4 ; ISO 10646 - The Universal Character Set with 31-bit code space, standardized as UCS-4 by ISO/IEC 10646. It is kept synchronized with the latest version of the Unicode code map. ; If this name is used in the encoding conversion facility, the converter attempts to identify by the preceding BOM (byte order mark)in which endian the subsequent bytes are represented. // ISO-10646-UCS-4 ; UCS-4 - See above. ; In contrast to UCS-4, strings are always assumed to be in big endian form. // ISO-10646-UCS-4 ; UCS-4 - See above. ; In contrast to UCS-4, strings are always assumed to be in little endian form. // ISO-10646-UCS-2 ; UCS-2 - The Universal Character Set with 16-bit code space, standardized as UCS-2 by ISO/IEC 10646. It is kept synchronized with the latest version of the unicode code map. ; If this name is used in the encoding conversion facility, the converter attempts to identify by the preceding BOM (byte order mark)in which endian the subsequent bytes are represented. // ISO-10646-UCS-2 ; UCS-2 - See above. ; In contrast to UCS-2, strings are always assumed to be in big endian form. // ISO-10646-UCS-2 ; UCS-2 - See above. ; In contrast to UCS-2, strings are always assumed to be in little endian form. // UTF-32 ; Unicode - Unicode Transformation Format of 32-bit unit width, whose encoding space refers to the Unicode's codeset standard. This encoding scheme wasn't identical to UCS-4 because the code space of Unicode were limited to a 21-bit value. ; If this name is used in the encoding conversion facility, the converter attempts to identify by the preceding BOM (byte order mark)in which endian the subsequent bytes are represented. // UTF-32BE ; Unicode - See above ; In contrast to UTF-32, strings are always assumed to be in big endian form. // UTF-32LE ; Unicode - See above ; In contrast to UTF-32, strings are always assumed to be in little endian form. // UTF-16 ; Unicode - Unicode Transformation Format of 16-bit unit width. It's worth a note that UTF-16 is no longer the same specification as UCS-2 because the surrogate mechanism has been introduced since Unicode 2.0 and UTF-16 now refers to a 21-bit code space. ; If this name is used in the encoding conversion facility, the converter attempts to identify by the preceding BOM (byte order mark)in which endian the subsequent bytes are represented. // UTF-16BE ; Unicode - See above. ; In contrast to UTF-16, strings are always assumed to be in big endian form. // UTF-16LE ; Unicode - See above. ; In contrast to UTF-16, strings are always assumed to be in little endian form. // UTF-8 ; Unicode / UCS - Unicode Transformation Format of 8-bit unit width. ; none // UTF-7 ; Unicode - A mail-safe transformation format of Unicode, specified in > RFC2152. ; none // (none) ; Unicode - A variant of UTF-7 which is specialized for use in the > IMAP protocol. ; none // US-ASCII (preferred MIME name) / iso-ir-6 / ANSI_X3.4-1986 / ISO_646.irv:1991 / ASCII / ISO646-US / us / IBM367 / CP367 / csASCII ; ASCII / ISO 646 - American Standard Code for Information Interchange is a commonly-used 7-bit encoding. Also standardized as an international standard, ISO 646. ; (none) // EUC-JP (preferred MIME name) / Extended_UNIX_Code_Packed_Format_for_Japanese / csEUCPkdFmtJapanese ; Compound of US-ASCII / JIS X0201:1997 (hankaku kana part) / JIS X0208:1990 / JIS X0212:1990 - As you see the name is derived from an abbreviation of Extended UNIX Code Packed Format for Japanese, this encoding is mostly used on UNIX or alike platforms. The original encoding scheme, Extended UNIX Code, is designed on the basis of ISO 2022. ; The character set referred to by EUC-JP is different to IBM932 / CP932, which are used by OS/2® and Microsoft® Windows®. For information interchange with those platforms, use EUCJP-WIN instead. // Shift_JIS (preferred MIME name) / MS_Kanji / csShift_JIS ; Compound of JIS X0201:1997 / JIS X0208:1997 - Shift_JIS was developed in early 80's, at the time personal Japanese word processors were brought into the market, in order to maintain compatibilities with the legacy encoding scheme JIS X 0201:1976. According to the IANA definition the codeset of Shift_JIS is slightly different to IBM932 / CP932. However, the names "SJIS" / "Shift_JIS" are often wrongly used to refer to these codesets. ; For the CP932 codemap, use SJIS-WIN instead. // (none) ; Compound of JIS X0201:1997 / JIS X0208:1997 / IBM extensions / NEC extensions - While this "encoding" uses the same encoding scheme as EUC-JP, the underlying character set is different. That is, some code points map to different characters than EUC-JP. ; none // Windows-31J / csWindows31J ; Compound of JIS X0201:1997 / JIS X0208:1997 / IBM extensions / NEC extensions - While this "encoding" uses the same encoding scheme as Shift_JIS, the underlying character set is different. That means some code points map to different characters than Shift_JIS. ; (none) // ISO-2022-JP (preferred MIME name) / csISO2022JP ; US-ASCII / JIS X0201:1976 / JIS X0208:1978 / JIS X0208:1983 - > RFC1468 ; (none) // JIS ; - ; // ISO-8859-1 ; - ; // ISO-8859-2 ; - ; // ISO-8859-3 ; - ; // ISO-8859-4 ; - ; // ISO-8859-5 ; - ; // ISO-8859-6 ; - ; // ISO-8859-7 ; - ; // ISO-8859-8 ; - ; // ISO-8859-9 ; - ; // ISO-8859-10 ; - ; // ISO-8859-13 ; - ; // ISO-8859-14 ; - ; // ISO-8859-15 ; - ; // ISO-8859-16 ; - ; // byte2be ; - ; // byte2le ; - ; // byte4be ; - ; // byte4le ; - ; // BASE64 ; - ; // HTML-ENTITIES ; - ; // 7bit ; - ; // 8bit ; - ; // EUC-CN ; - ; // CP936 ; - ; // HZ ; - ; // EUC-TW ; - ; // CP950 ; - ; // BIG-5 ; - ; // EUC-KR ; - ; // UHC (CP949) ; - ; // ISO-2022-KR ; - ; // Windows-1251 (CP1251) ; - ; // Windows-1252 (CP1252) ; - ; // CP866 (IBM866) ; - ; // KOI8-R ; - ; // KOI8-U ; - ; // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.encodings.php // SUMMARIES_OF_SUPPORTED_ENCODINGS - END // // BASICS_OF_JAPANESE_MULTI_BYTE_ENCODINGS - BEGIN // Basics of Japanese multi-byte encodings // // Japanese characters can only be represented by multibyte encodings, and multiple encoding standards are used depending on platform and text purpose. To make matters worse, these encoding standards differ slightly from one another. In order to create a web application which would be usable in a Japanese environment, a developer has to keep these complexities in mind to ensure that the proper character encodings are used. // * Storage for a character can be up to six bytes // * Most Japanese multibyte characters appear twice as wide as single-byte characters. These characters are called "zen-kaku" in Japanese, which means "full width". Other, narrower, characters are called "han-kaku", which means "half width". The graphical properties of the characters, however, depends upon the type faces used to display them. // * Some character encodings use shift(escape) sequences defined in ISO-2022 to switch the code map of the specific code area (00h to 7fh). // * ISO-2022-JP should be used in SMTP/NNTP, and headers and entities should be reencoded as per RFC requirements. Although those are not requisites, it's still a good idea because several popular user agents cannot recognize any other encoding methods. // * Web pages created for mobile phone services such as > i-mode or > EZweb are supposed to use Shift_JIS. // * Emoji used for mobile phone service such as > i-mode or > EZweb are supported. // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.ja-basic.php // BASICS_OF_JAPANESE_MULTI_BYTE_ENCODINGS - END // // HTTP_INPUT_AND_OUTPUT - BEGIN // HTTP Input and Output // // HTTP input/output character encoding conversion may convert binary data also. Users are supposed to control character encoding conversion if binary data is used for HTTP input/output. // Note: If enctype for HTML form is set to multipart/form-data and mbstring.encoding_translation is set to On in php.ini the POST'ed variables and the names of uploaded files will be converted to the internal character encoding as well. However, the conversion isn't applied to the query keys. // * HTTP Input // There is no way to control HTTP input character conversion from a PHP script. To disable HTTP input character conversion, it has to be done in php.ini. // [example] // Example #1 Disable HTTP input conversion in php.ini // [code] // ;; Disable HTTP Input conversion // mbstring.http_input = pass // ;; Disable HTTP Input conversion // mbstring.encoding_translation = Off // [/code] // [/example] // When using PHP as an Apache module, it is possible to override those settings in each Virtual Host directive in httpd.conf or per directory with .htaccess. Refer to the Configuration section and Apache Manual for details. // * HTTP Output // There are several ways to enable output character encoding conversion. One is using php.ini, another is using ob_start() with mb_output_handler() as the ob_start callback function. // [example] // Example #2 php.ini setting example // [code] // ;; Enable output character encoding conversion for all PHP pages // // ;; Enable Output Buffering // output_buffering = On // // ;; Set mb_output_handler to enable output conversion // output_handler = mb_output_handler // [/code] // [/example] // [example] // Example #3 Script example // [php] // // // Enable output character encoding conversion only for this page // // // Set HTTP output character encoding to SJIS // mb_http_output('SJIS'); // // // Start buffering and specify "mb_output_handler" as // // callback function // ob_start('mb_output_handler'); // // [/php] // [/example] // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.http.php // HTTP_INPUT_AND_OUTPUT - END // // SUPPORTED_CHARACTER_ENCODINGS - BEGIN // Supported Character Encodings // // Currently the following character encodings are supported by the mbstring module. Any of those Character encodings can be specified in the encoding parameter of mbstring functions. // // The following character encodings are supported in this PHP extension: // * UCS-4* // * UCS-4BE // * UCS-4LE* // * UCS-2 // * UCS-2BE // * UCS-2LE // * UTF-32* // * UTF-32BE* // * UTF-32LE* // * UTF-16* // * UTF-16BE* // * UTF-16LE* // * UTF-7 // * UTF7-IMAP // * UTF-8* // * ASCII* // * EUC-JP* // * SJIS* // * eucJP-win* // * SJIS-win* // * ISO-2022-JP // * ISO-2022-JP-MS // * CP932 // * CP51932 // * SJIS-mac (alias: MacJapanese) // * SJIS-Mobile#DOCOMO (alias: SJIS-DOCOMO) // * SJIS-Mobile#KDDI (alias: SJIS-KDDI) // * SJIS-Mobile#SOFTBANK (alias: SJIS-SOFTBANK) // * UTF-8-Mobile#DOCOMO (alias: UTF-8-DOCOMO) // * UTF-8-Mobile#KDDI-A // * UTF-8-Mobile#KDDI-B (alias: UTF-8-KDDI) // * UTF-8-Mobile#SOFTBANK (alias: UTF-8-SOFTBANK) // * ISO-2022-JP-MOBILE#KDDI (alias: ISO-2022-JP-KDDI) // * JIS // * JIS-ms // * CP50220 // * CP50220raw // * CP50221 // * CP50222 // * ISO-8859-1* // * ISO-8859-2* // * ISO-8859-3* // * ISO-8859-4* // * ISO-8859-5* // * ISO-8859-6* // * ISO-8859-7* // * ISO-8859-8* // * ISO-8859-9* // * ISO-8859-10* // * ISO-8859-13* // * ISO-8859-14* // * ISO-8859-15* // * ISO-8859-16* // * byte2be // * byte2le // * byte4be // * byte4le // * BASE64 // * HTML-ENTITIES (alias: HTML) // * 7bit // * 8bit // * EUC-CN* // * CP936 // * GB18030 // * HZ // * EUC-TW* // * CP950 // * BIG-5* // * EUC-KR* // * UHC (alias: CP949) // * ISO-2022-KR // * Windows-1251 (alias: CP1251) // * Windows-1252 (alias: CP1252) // * CP866 (alias: IBM866) // * KOI8-R* // * KOI8-U* // * ArmSCII-8 (alias: ArmSCII8) // * denotes encodings usable also in regular expressions. // // Any php.ini entry which accepts an encoding name can also use the values "auto" and "pass". mbstring functions which accept an encoding name can also use the value "auto". // If "pass" is set, no character encoding conversion is performed. // If "auto" is set, it is expanded to the list of encodings defined per the NLS. For instance, if the NLS is set to Japanese, the value is assumed to be "ASCII,JIS,UTF-8,EUC-JP,SJIS". // See also mb_detect_order() // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.supported-encodings.php // SUPPORTED_CHARACTER_ENCODINGS - END // // FUNCTION_OVERLOADING_FEATURE - BEGIN // Function Overloading Feature // // Warning: This feature has been DEPRECATED as of PHP 7.2.0, and REMOVED as of PHP 8.0.0. Relying on this feature is highly discouraged. // You might often find it difficult to get an existing PHP application to work in a given multibyte environment. This happens because most PHP applications out there are written with the standard string functions such as substr(), which are known to not properly handle multibyte-encoded strings. // mbstring supports a 'function overloading' feature which enables you to add multibyte awareness to such an application without code modification by overloading multibyte counterparts on the standard string functions. For example, mb_substr() is called instead of substr() if function overloading is enabled. This feature makes it easy to port applications that only support single-byte encodings to a multibyte environment in many cases. // To use function overloading, set mbstring.func_overload in php.ini to a positive value that represents a combination of bitmasks specifying the categories of functions to be overloaded. It should be set to 1 to overload the mail() function. 2 for string functions, 4 for regular expression functions. For example, if it is set to 7, mail, strings and regular expression functions will be overloaded. The list of overloaded functions are shown below. // // Functions to be overloaded // value of mbstring.func_overload | original function | overloaded function // 1 | mail() | mb_send_mail() // 2 | strlen() | mb_strlen() // 2 | strpos() | mb_strpos() // 2 | strrpos() | mb_strrpos() // 2 | substr() | mb_substr() // 2 | strtolower() | mb_strtolower() // 2 | strtoupper() | mb_strtoupper() // 2 | stripos() | mb_stripos() // 2 | strripos() | mb_strripos() // 2 | strstr() | mb_strstr() // 2 | stristr() | mb_stristr() // 2 | strrchr() | mb_strrchr() // 2 | substr_count() | mb_substr_count() // Note: It is not recommended to use the function overloading option in the per-directory context, because it's not confirmed yet to be stable enough in a production environment and may lead to undefined behaviour. // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.overload.php // FUNCTION_OVERLOADING_FEATURE - END // // PHP_CHARACTER_ENCODING_REQUIREMENTS - BEGIN // PHP Character Encoding Requirements // // Encodings of the following types are safely used with PHP. // * A singlebyte encoding, // * which has ASCII-compatible (ISO646 compatible) mappings for the characters in range of 00h to 7fh. // * A multibyte encoding, // * which has ASCII-compatible mappings for the characters in range of 00h to 7fh. // * which don't use ISO2022 escape sequences. // * which don't use a value from 00h to 7fh in any of the compounded bytes that represents a single character. // These are examples of character encodings that are unlikely to work with PHP. // JIS, SJIS, ISO-2022-JP, BIG-5 // Although PHP scripts written in any of those encodings might not work, especially in the case where encoded strings appear as identifiers or literals in the script, you can almost avoid using these encodings by setting up the mbstring's transparent encoding filter function for incoming HTTP queries. // Note: It's highly discouraged to use SJIS, BIG5, CP936, CP949 and GB18030 for the internal encoding unless you are familiar with the parser, the scanner and the character encoding. // Note: // If you are connecting to a database with PHP, it is recommended that you use the same character encoding for both the database and the internal encoding for ease of use and better performance. // If you are using PostgreSQL, the character encoding used in the database and the one used in PHP may differ as it supports automatic character set conversion between the backend and the frontend. // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/mbstring.php4.req.php // PHP_CHARACTER_ENCODING_REQUIREMENTS - END // // MULTIBYTE_STRING_FUNCTIONS - BEGIN // Multibyte String Functions // // References // Multibyte character encoding schemes and their related issues are fairly complicated, and are beyond the scope of this documentation. Please refer to the following URLs and other resources for further information regarding these topics. // * Unicode materials // > http://www.unicode.org/ // * Japanese/Korean/Chinese character information // > https://resources.oreilly.com/examples/9781565922242/blob/master/doc/cjk.inf // // Table of Contents // * mb_check_encoding - Check if strings are valid for the specified encoding // * mb_chr - Return character by Unicode code point value // * mb_convert_case - Perform case folding on a string // * mb_convert_encoding - Convert a string from one character encoding to another // * mb_convert_kana - Convert "kana" one from another ("zen-kaku", "han-kaku" and more) // * mb_convert_variables - Convert character code in variable(s) // * mb_decode_mimeheader - Decode string in MIME header field // * mb_decode_numericentity - Decode HTML numeric string reference to character // * mb_detect_encoding - Detect character encoding // * mb_detect_order - Set/Get character encoding detection order // * mb_encode_mimeheader - Encode string for MIME header // * mb_encode_numericentity - Encode character to HTML numeric string reference // * mb_encoding_aliases - Get aliases of a known encoding type // * mb_ereg_match - Regular expression match for multibyte string // * mb_ereg_replace_callback - Perform a regular expression search and replace with multibyte support using a callback // * mb_ereg_replace - Replace regular expression with multibyte support // * mb_ereg_search_getpos - Returns start point for next regular expression match // * mb_ereg_search_getregs - Retrieve the result from the last multibyte regular expression match // * mb_ereg_search_init - Setup string and regular expression for a multibyte regular expression match // * mb_ereg_search_pos - Returns position and length of a matched part of the multibyte regular expression for a predefined multibyte string // * mb_ereg_search_regs - Returns the matched part of a multibyte regular expression // * mb_ereg_search_setpos - Set start point of next regular expression match // * mb_ereg_search - Multibyte regular expression match for predefined multibyte string // * mb_ereg - Regular expression match with multibyte support // * mb_eregi_replace - Replace regular expression with multibyte support ignoring case // * mb_eregi - Regular expression match ignoring case with multibyte support // * mb_get_info - Get internal settings of mbstring // * mb_http_input - Detect HTTP input character encoding // * mb_http_output - Set/Get HTTP output character encoding // * mb_internal_encoding - Set/Get internal character encoding // * mb_language - Set/Get current language // * mb_list_encodings - Returns an array of all supported encodings // * mb_ord - Get Unicode code point of character // * mb_output_handler - Callback function converts character encoding in output buffer // * mb_parse_str - Parse GET/POST/COOKIE data and set global variable // * mb_preferred_mime_name - Get MIME charset string // * mb_regex_encoding - Set/Get character encoding for multibyte regex // * mb_regex_set_options - Set/Get the default options for mbregex functions // * mb_scrub - Replace ill-formed byte sequences with the substitute character // * mb_send_mail - Send encoded mail // * mb_split - Split multibyte string using regular expression // * mb_str_pad - Pad a multibyte string to a certain length with another multibyte string // * mb_str_split - Given a multibyte string, return an array of its characters // * mb_strcut - Get part of string // * mb_strimwidth - Get truncated string with specified width // * mb_stripos - Finds position of first occurrence of a string within another, case insensitive // * mb_stristr - Finds first occurrence of a string within another, case insensitive // * mb_strlen - Get string length // * mb_strpos - Find position of first occurrence of string in a string // * mb_strrchr - Finds the last occurrence of a character in a string within another // * mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitive // * mb_strripos - Finds position of last occurrence of a string within another, case insensitive // * mb_strrpos - Find position of last occurrence of a string in a string // * mb_strstr - Finds first occurrence of a string within another // * mb_strtolower - Make a string lowercase // * mb_strtoupper - Make a string uppercase // * mb_strwidth - Return width of string // * mb_substitute_character - Set/Get substitution character // * mb_substr_count - Count the number of substring occurrences // * mb_substr - Get part of string // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/ref.mbstring.php // MULTIBYTE_STRING_FUNCTIONS - END // // LITERATURE_SOURCES // * PHP_NET (2023-09-18) // URL: https://www.php.net/manual/en/book.mbstring.php // MULTIBYTE_STRING - END // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_CHECK_ENCODING // ============================== PUBLIC // ============================== ABOUT // Check if strings are valid for the specified encoding. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_check_encoding() - PHP_4 >= PHP_4_4_3, PHP_5 >= PHP_5_1_3, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_check_encoding($value = null, $encoding = null) { $return_mb_check_encoding = false; // ========== MB_CHECK_ENCODING - BEGIN // ===== ABOUT // Check if strings are valid for the specified encoding // ===== DESCRIPTION // Checks if the specified byte stream is valid for the specified encoding. If value is of type array, all keys and values are validated recursively. It is useful to prevent so-called "Invalid Encoding Attack". // ===== SUPPORTED // PHP_4 >= PHP_4_4_3, PHP_5 >= PHP_5_1_3, PHP_7, PHP_8 // ===== SYNTAX // mb_check_encoding(array|string|null $value = null, ?string $encoding = null): bool // ===== CODE $return_mb_check_encoding = mb_check_encoding( $value, // array|string|null value - The byte stream or array to check. If it is omitted, this function checks all the input from the beginning of the request. // Warning: As of PHP 8.1.0, omitting this parameter or passing null is deprecated. $encoding // string encoding - The expected encoding. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.1.0 - Calling this function with null as value or without argument is deprecated. // 8.0.0 - value and encoding are nullable now. // 7.2.0 - This function now also accepts an array as value. Formerly, only strings have been supported. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-check-encoding.php // ========== MB_CHECK_ENCODING - END // SYNTAX: // bool mb_check_encoding(array|string|null $value = null, string $encoding = null) return $return_mb_check_encoding; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_CHECK_ENCODING // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_CHR // ============================== OFFLINE // ============================== ABOUT // Return character by Unicode code point value. // ============================== SUPPORT // PHP_7 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_chr() - PHP_7 >= PHP_7_2_0, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_chr($codepoint, $encoding = null) { $return_mb_chr = false; // ========== MB_CHR - BEGIN // ===== ABOUT // Return character by Unicode code point value // ===== DESCRIPTION // Returns a string containing the character specified by the Unicode code point value, encoded in the specified encoding. // This function complements mb_ord(). // ===== SUPPORTED // PHP_7 >= PHP_7_2_0, PHP_8 // ===== SYNTAX // mb_chr(int $codepoint, ?string $encoding = null): string|false // ===== CODE $return_mb_chr = mb_chr( $codepoint, // int codepoint - A Unicode codepoint value, e.g. 128024 for U+1F418 ELEPHANT $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // A string containing the requested character, if it can be represented in the specified encoding or false on failure. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // Example #1 Testing different code points // [php] // $values = [65, 63, 0x20AC, 128024]; // foreach ($values as $value) { // var_dump(mb_chr($value, 'UTF-8')); // var_dump(mb_chr($value, 'ISO-8859-1')); // } // [/php] // The above example will output: // [result] // string(1) "A" // string(1) "A" // string(1) "?" // string(1) "?" // string(3) "€" // bool(false) // string(4) "🐘" // bool(false) // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-chr.php // ========== MB_CHR - END // SYNTAX: // string|false mb_chr(int $codepoint, string $encoding = null) return $return_mb_chr; // string|false } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_CHR // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_CONVERT_CASE // ============================== PUBLIC // ============================== ABOUT // Perform case folding on a string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_convert_case() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_convert_case($string, $mode, $encoding = null) { $return_mb_convert_case = null; // ========== MB_CONVERT_CASE - BEGIN // ===== ABOUT // Perform case folding on a string // ===== DESCRIPTION // Performs case folding on a string, converted in the way specified by mode. // ===== SUPPORTED // PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_convert_case(string $string, int $mode, ?string $encoding = null): string // ===== CODE $return_mb_convert_case = mb_convert_case( $string, // string string - The string being converted. $mode, // int mode - The mode of the conversion. It can be one of MB_CASE_UPPER, MB_CASE_LOWER, MB_CASE_TITLE, MB_CASE_FOLD, MB_CASE_UPPER_SIMPLE, MB_CASE_LOWER_SIMPLE, MB_CASE_TITLE_SIMPLE, MB_CASE_FOLD_SIMPLE. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // A case folded version of string converted in the way specified by mode. // // Changelog // Version - Description // 7.3.0 - Added support for MB_CASE_FOLD, MB_CASE_UPPER_SIMPLE, MB_CASE_LOWER_SIMPLE, MB_CASE_TITLE_SIMPLE, and MB_CASE_FOLD_SIMPLE as mode. // // [examples] // Examples // [example] // Example #1 mb_convert_case() example // [php] // $str = "mary had a Little lamb and she loved it so"; // $str = mb_convert_case($str, MB_CASE_UPPER, "UTF-8"); // echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO // $str = mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); // echo $str; // Prints Mary Had A Little Lamb And She Loved It So // [/php] // [/example] // [example] // Example #2 mb_convert_case() example with non-Latin UTF-8 text // [php] // $str = "Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός"; // $str = mb_convert_case($str, MB_CASE_UPPER, "UTF-8"); // echo $str; // Prints ΤΆΧΙΣΤΗ ΑΛΏΠΗΞ ΒΑΦΉΣ ΨΗΜΈΝΗ ΓΗ, ΔΡΑΣΚΕΛΊΖΕΙ ΥΠΈΡ ΝΩΘΡΟΎ ΚΥΝΌΣ // $str = mb_convert_case($str, MB_CASE_TITLE, "UTF-8"); // echo $str; // Prints Τάχιστη Αλώπηξ Βαφήσ Ψημένη Γη, Δρασκελίζει Υπέρ Νωθρού Κυνόσ // [/php] // [/example] // [/examples] // // Notes // By contrast to the standard case folding functions such as strtolower() and strtoupper(), case folding is performed on the basis of the Unicode character properties. Thus the behaviour of this function is not affected by locale settings and it can convert any characters that have 'alphabetic' property, such a-umlaut (ä). // For more information about the Unicode properties, please see > http://www.unicode.org/reports/tr21/. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-convert-case.php // ========== MB_CONVERT_CASE - END // SYNTAX: // string mb_convert_case(string $string, int $mode, string $encoding = null) return $return_mb_convert_case; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_CONVERT_CASE // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_CONVERT_ENCODING // ============================== PUBLIC // ============================== ABOUT // Convert a string from one character encoding to another. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_convert_encoding() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_convert_encoding($string, $to_encoding, $from_encoding = null) { $return_mb_convert_encoding = false; // ========== MB_CONVERT_ENCODING - BEGIN // ===== ABOUT // Convert a string from one character encoding to another // ===== DESCRIPTION // Converts string from from_encoding, or the current internal encoding, to to_encoding. If string is an array, all its string values will be converted recursively. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_convert_encoding(array|string $string, string $to_encoding, array|string|null $from_encoding = null): array|string|false // ===== CODE $return_mb_convert_encoding = mb_convert_encoding( $string, // array|string string - The string or array to be converted. $to_encoding, // string to_encoding - The desired encoding of the result. $from_encoding // array|string|null from_encoding - The current encoding used to interpret string. Multiple encodings may be specified as an array or comma separated list, in which case the correct encoding will be guessed using the same algorithm as mb_detect_encoding(). // If from_encoding is omitted or null, the mbstring.internal_encoding setting will be used if set, otherwise the default_charset setting. // See supported encodings for valid values of to_encoding and from_encoding. ); // Return Values // The encoded string or array on success, or false on failure. // // Errors/Exceptions // As of PHP 8.0.0, a ValueError is thrown if the value of to_encoding or from_encoding is an invalid encoding. Prior to PHP 8.0.0, a E_WARNING was emitted instead. // // Changelog // Version - Description // 8.0.0 - mb_convert_encoding() will now throw a ValueError when to_encoding is passed an invalid encoding. // 8.0.0 - mb_convert_encoding() will now throw a ValueError when from_encoding is passed an invalid encoding. // 8.0.0 - from_encoding is nullable now. // 7.2.0 - This function now also accepts an array as string. Formerly, only strings have been supported. // // [examples] // Examples // [example] // Example #1 mb_convert_encoding() example // [php] // // Convert internal character encoding to SJIS // $str = mb_convert_encoding($str, "SJIS"); // // // Convert EUC-JP to UTF-7 // $str = mb_convert_encoding($str, "UTF-7", "EUC-JP"); // // // Auto detect encoding from JIS, eucjp-win, sjis-win, then convert str to UCS-2LE // $str = mb_convert_encoding($str, "UCS-2LE", "JIS, eucjp-win, sjis-win"); // // // If mbstring.language is "Japanese", "auto" is expanded to "ASCII,JIS,UTF-8,EUC-JP,SJIS" // $str = mb_convert_encoding($str, "EUC-JP", "auto"); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-convert-encoding.php // ========== MB_CONVERT_ENCODING - END // SYNTAX: // array|string|false mb_convert_encoding(array|string $string, string $to_encoding, array|string|null $from_encoding = null) return $return_mb_convert_encoding; // array|string|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_CONVERT_ENCODING // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_CONVERT_KANA // ============================== PUBLIC // ============================== ABOUT // Convert "kana" one from another ("zen-kaku", "han-kaku" and more). // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_convert_kana() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_convert_kana($string, $mode = "KV", $encoding = null) { $return_mb_convert_kana = null; // ========== MB_CONVERT_KANA - BEGIN // ===== ABOUT // Convert "kana" one from another ("zen-kaku", "han-kaku" and more) // ===== DESCRIPTION // Performs a "han-kaku" - "zen-kaku" conversion for string string. This function is only useful for Japanese. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_convert_kana(string $string, string $mode = "KV", ?string $encoding = null): string // ===== CODE $return_mb_convert_kana = mb_convert_kana( $string, // string string - The string being converted. $mode, // string mode - The conversion option. // Specify with a combination of following options. // // Applicable Conversion Options // Option - Meaning // r - Convert "zen-kaku" alphabets to "han-kaku" // R - Convert "han-kaku" alphabets to "zen-kaku" // n - Convert "zen-kaku" numbers to "han-kaku" // N - Convert "han-kaku" numbers to "zen-kaku" // a - Convert "zen-kaku" alphabets and numbers to "han-kaku" // A - Convert "han-kaku" alphabets and numbers to "zen-kaku" (Characters included in "a", "A" options are U+0021 - U+007E excluding U+0022, U+0027, U+005C, U+007E) // s - Convert "zen-kaku" space to "han-kaku" (U+3000 -> U+0020) // S - Convert "han-kaku" space to "zen-kaku" (U+0020 -> U+3000) // k - Convert "zen-kaku kata-kana" to "han-kaku kata-kana" // K - Convert "han-kaku kata-kana" to "zen-kaku kata-kana" // h - Convert "zen-kaku hira-gana" to "han-kaku kata-kana" // H - Convert "han-kaku kata-kana" to "zen-kaku hira-gana" // c - Convert "zen-kaku kata-kana" to "zen-kaku hira-gana" // C - Convert "zen-kaku hira-gana" to "zen-kaku kata-kana" // V - Collapse voiced sound notation and convert them into a character. Use with "K","H" $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // The converted string. // // Errors/Exceptions // Throws a ValueError if the combination of different modes is invalid. For example "sS". // // Changelog // Version - Description // 8.2.0 - A ValueError is now thrown if the combination of different modes is invalid. // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // Example #1 mb_convert_kana() example // [php] // // Convert all "kana" to "zen-kaku" "kata-kana" // $str = mb_convert_kana($str, "KVC"); // // // Convert "han-kaku" "kata-kana" to "zen-kaku" "kata-kana" // // and "zen-kaku" alphanumeric to "han-kaku" // $str = mb_convert_kana($str, "KVa"); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-convert-kana.php // ========== MB_CONVERT_KANA - END // SYNTAX: // string mb_convert_kana(string $string, string $mode = "KV", string $encoding = null) return $return_mb_convert_kana; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_CONVERT_KANA // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_CONVERT_VARIABLES // ============================== PUBLIC // ============================== ABOUT // Convert character code in variable(s). // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_convert_variables() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_convert_variables($to_encoding, $from_encoding, & $var, & $vars) { $return_mb_convert_variables = false; // ========== MB_CONVERT_VARIABLES - BEGIN // ===== ABOUT // Convert character code in variable(s) // ===== DESCRIPTION // Converts character encoding of variables var and vars in encoding from_encoding to encoding to_encoding. // mb_convert_variables() join strings in Array or Object to detect encoding, since encoding detection tends to fail for short strings. Therefore, it is impossible to mix encoding in single array or object. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_convert_variables( // string $to_encoding, // array|string $from_encoding, // mixed &$var, // mixed &...$vars // ): string|false // ===== CODE $return_mb_convert_variables = mb_convert_variables( $to_encoding, // string to_encoding - The encoding that the string is being converted to. $from_encoding, // array|string from_encoding - from_encoding is specified as an array or comma separated string, it tries to detect encoding from from-coding. When from_encoding is omitted, detect_order is used. $var, // mixed& var - var is the reference to the variable being converted. String, Array and Object are accepted. mb_convert_variables() assumes all parameters have the same encoding. $vars // mixed& vars - Additional vars. ); // Return Values // The character encoding before conversion for success, or false for failure. // // [examples] // Examples // [example] // Example #1 mb_convert_variables() example // [php] // // Convert variables $post1, $post2 to internal encoding // $interenc = mb_internal_encoding(); // $inputenc = mb_convert_variables($interenc, "ASCII,UTF-8,SJIS-win", $post1, $post2); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-convert-variables.php // ========== MB_CONVERT_VARIABLES - END // SYNTAX: // string|false mb_convert_variables(string $to_encoding, array|string $from_encoding, mixed& $var, mixed& $vars) return $return_mb_convert_variables; // string|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_CONVERT_VARIABLES // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_DECODE_MIMEHEADER // ============================== PUBLIC // ============================== ABOUT // Decode string in MIME header field. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_decode_mimeheader() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_decode_mimeheader($string) { $return_mb_decode_mimeheader = null; // ========== MB_DECODE_MIMEHEADER - BEGIN // ===== ABOUT // Decode string in MIME header field // ===== DESCRIPTION // Decodes encoded-word string string in MIME header. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_decode_mimeheader(string $string): string // ===== CODE $return_mb_decode_mimeheader = mb_decode_mimeheader( $string // string string - The string being decoded. ); // Return Values // The decoded string in internal character encoding. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-decode-mimeheader.php // ========== MB_DECODE_MIMEHEADER - END // SYNTAX: // string mb_decode_mimeheader(string $string) return $return_mb_decode_mimeheader; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_DECODE_MIMEHEADER // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_DECODE_NUMERICENTITY // ============================== PUBLIC // ============================== ABOUT // Decode HTML numeric string reference to character. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_decode_numericentity() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_decode_numericentity($string, $map, $encoding = null) { $return_mb_decode_numericentity = null; // ========== MB_DECODE_NUMERICENTITY - BEGIN // ===== ABOUT // Decode HTML numeric string reference to character // ===== DESCRIPTION // Convert numeric string reference of string string in a specified block to character. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_decode_numericentity(string $string, array $map, ?string $encoding = null): string // ===== CODE $return_mb_decode_numericentity = mb_decode_numericentity( $string, // string string - The string being decoded. $map, // array map - map is an array that specifies the code area to convert. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. // is_hex - This parameter is not used. ); // Return Values // The converted string. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // Example #1 map example // [php] // $convmap = array ( // int start_code1, int end_code1, int offset1, int mask1, // int start_code2, int end_code2, int offset2, int mask2, // ........ // int start_codeN, int end_codeN, int offsetN, int maskN ); // // Specify Unicode value for start_codeN and end_codeN // // Add offsetN to value and take bit-wise 'AND' with maskN, // // then convert value to numeric string reference. // [/php] // [/example] // [example] // Example #2 map example escapes JavaScript string // [php] // function escape_javascript_string($str) { // $map = [ // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,0,0, // 49 // 0,0,0,0,0,0,0,0,1,1, // 1,1,1,1,1,0,0,0,0,0, // 0,0,0,0,0,0,0,0,0,0, // 0,0,0,0,0,0,0,0,0,0, // 0,1,1,1,1,1,1,0,0,0, // 99 // 0,0,0,0,0,0,0,0,0,0, // 0,0,0,0,0,0,0,0,0,0, // 0,0,0,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 149 // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 199 // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 1,1,1,1,1,1,1,1,1,1, // 249 // 1,1,1,1,1,1,1, // 255 // ]; // // Char encoding is UTF-8 // $mblen = mb_strlen($str, 'UTF-8'); // $utf32 = bin2hex(mb_convert_encoding($str, 'UTF-32', 'UTF-8')); // for ($i=0, $encoded=''; $i < $mblen; $i++) { // $u = substr($utf32, $i*8, 8); // $v = base_convert($u, 16, 10); // if ($v < 256 && $map[$v]) { // $encoded .= '\\x'.substr($u, 6,2); // } else if ($v == 2028) { // $encoded .= '\\u2028'; // } else if ($v == 2029) { // $encoded .= '\\u2029'; // } else { // $encoded .= mb_convert_encoding(hex2bin($u), 'UTF-8', 'UTF-32'); // } // } // return $encoded; // } // // // Test data // $convmap = [ 0x0, 0xffff, 0, 0xffff ]; // $msg = ''; // for ($i=0; $i < 1000; $i++) { // // chr() cannot generate correct UTF-8 data larger value than 128, use mb_decode_numericentity(). // $msg .= mb_decode_numericentity('&#'.$i.';', $convmap, 'UTF-8'); // } // // // var_dump($msg); // var_dump(escape_javascript_string($msg)); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-decode-numericentity.php // ========== MB_DECODE_NUMERICENTITY - END // SYNTAX: // string mb_decode_numericentity(string $string, array $map, string $encoding = null) return $return_mb_decode_numericentity; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_DECODE_NUMERICENTITY // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_DETECT_ENCODING // ============================== PUBLIC // ============================== ABOUT // Detect character encoding. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_detect_encoding() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_detect_encoding($string, $encodings = null, $strict = false) { $return_mb_detect_encoding = false; // ========== MB_DETECT_ENCODING - BEGIN // ===== ABOUT // Detect character encoding // ===== DESCRIPTION // Detects the most likely character encoding for string string from an ordered list of candidates. // Automatic detection of the intended character encoding can never be entirely reliable; without some additional information, it is similar to decoding an encrypted string without the key. It is always preferable to use an indication of character encoding stored or transmitted with the data, such as a "Content-Type" HTTP header. // This function is most useful with multibyte encodings, where not all sequences of bytes form a valid string. If the input string contains such a sequence, that encoding will be rejected, and the next encoding checked. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_detect_encoding(string $string, array|string|null $encodings = null, bool $strict = false): string|false // ===== CODE $return_mb_detect_encoding = mb_detect_encoding( $string, // string string - The string being inspected. $encodings, // array|string|null encodings - A list of character encodings to try, in order. The list may be specified as an array of strings, or a single string separated by commas. // If encodings is omitted or null, the current detect_order (set with the mbstring.detect_order configuration option, or mb_detect_order() function) will be used. $strict // bool strict - Controls the behaviour when string is not valid in any of the listed encodings. If strict is set to false, the closest matching encoding will be returned; if strict is set to true, false will be returned. // The default value for strict can be set with the mbstring.strict_detection configuration option. ); // Return Values // The detected character encoding, or false if the string is not valid in any of the listed encodings. // // [examples] // Examples // [example] // Example #1 mb_detect_encoding() example // [php] // // Detect character encoding with current detect_order // echo mb_detect_encoding($str); // // // "auto" is expanded according to mbstring.language // echo mb_detect_encoding($str, "auto"); // // // Specify "encodings" parameter by list separated by comma // echo mb_detect_encoding($str, "JIS, eucjp-win, sjis-win"); // // // Use array to specify "encodings" parameter // $encodings = [ // "ASCII", // "JIS", // "EUC-JP" // ]; // echo mb_detect_encoding($str, $encodings); // [/php] // [/example] // [example] // Example #2 Effect of strict parameter // [php] // // 'áéóú' encoded in ISO-8859-1 // $str = "\xE1\xE9\xF3\xFA"; // // // The string is not valid ASCII or UTF-8, but UTF-8 is considered a closer match // var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8'], false)); // var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8'], true)); // // // If a valid encoding is found, the strict parameter does not change the result // var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8', 'ISO-8859-1'], false)); // var_dump(mb_detect_encoding($str, ['ASCII', 'UTF-8', 'ISO-8859-1'], true)); // [/php] // The above example will output: // [result] // string(5) "UTF-8" // bool(false) // string(10) "ISO-8859-1" // string(10) "ISO-8859-1" // [/result] // In some cases, the same sequence of bytes may form a valid string in multiple character encodings, and it is impossible to know which interpretation was intended. For instance, among many others, the byte sequence "\xC4\xA2" could be: // * "Ä¢" (U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS followed by U+00A2 CENT SIGN) encoded in any of ISO-8859-1, ISO-8859-15, or Windows-1252 // * "ФЂ" (U+0424 CYRILLIC CAPITAL LETTER EF followed by U+0402 CYRILLIC CAPITAL LETTER DJE) encoded in ISO-8859-5 // * "Ģ" (U+0122 LATIN CAPITAL LETTER G WITH CEDILLA) encoded in UTF-8 // [/example] // [example] // Example #3 Effect of order when multiple encodings match // [php] // $str = "\xC4\xA2"; // // // The string is valid in all three encodings, so the first one listed will be returned // var_dump(mb_detect_encoding($str, ['UTF-8', 'ISO-8859-1', 'ISO-8859-5'])); // var_dump(mb_detect_encoding($str, ['ISO-8859-1', 'ISO-8859-5', 'UTF-8'])); // var_dump(mb_detect_encoding($str, ['ISO-8859-5', 'UTF-8', 'ISO-8859-1'])); // [/php] // The above example will output: // [result] // string(5) "UTF-8" // string(10) "ISO-8859-1" // string(10) "ISO-8859-5" // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-detect-encoding.php // ========== MB_DETECT_ENCODING - END // SYNTAX: // string|false mb_detect_encoding(string $string, array|string|null $encodings = null, bool $strict = false) return $return_mb_detect_encoding; // string|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_DETECT_ENCODING // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_DETECT_ORDER // ============================== PUBLIC // ============================== ABOUT // Set/Get character encoding detection order. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_detect_order() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_detect_order($encoding = null) { $return_mb_detect_order = false; // ========== MB_DETECT_ORDER - BEGIN // ===== ABOUT // Set/Get character encoding detection order // ===== DESCRIPTION // Sets the automatic character encoding detection order to encoding. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_detect_order(array|string|null $encoding = null): array|bool // ===== CODE $return_mb_detect_order = mb_detect_order( $encoding // array|string|null encoding - encoding is an array or comma separated list of character encoding. See supported encodings. // If encoding is omitted or null, it returns the current character encoding detection order as array. // This setting affects mb_detect_encoding() and mb_send_mail(). // mbstring currently implements the following encoding detection filters. If there is an invalid byte sequence for the following encodings, encoding detection will fail. // UTF-8, UTF-7, ASCII, EUC-JP,SJIS, eucJP-win, SJIS-win, JIS, ISO-2022-JP // For ISO-8859-*, mbstring always detects as ISO-8859-*. // For UTF-16, UTF-32, UCS2 and UCS4, encoding detection will fail always. ); // Return Values // When setting the encoding detection order, true is returned on success or false on failure. // When getting the encoding detection order, an ordered array of the encodings is returned. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // Example #1 mb_detect_order() examples // [php] // // Set detection order by enumerated list // mb_detect_order("eucjp-win,sjis-win,UTF-8"); // // // Set detection order by array // $ary[] = "ASCII"; // $ary[] = "JIS"; // $ary[] = "EUC-JP"; // mb_detect_order($ary); // // // Display current detection order // echo implode(", ", mb_detect_order()); // [/php] // [/example] // [example] // Example #2 Example showing useless detect orders // [code] // ; Always detect as ISO-8859-1 // detect_order = ISO-8859-1, UTF-8 // // ; Always detect as UTF-8, since ASCII/UTF-7 values are // ; valid for UTF-8 // detect_order = UTF-8, ASCII, UTF-7 // [/code] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-detect-order.php // ========== MB_DETECT_ORDER - END // SYNTAX: // array|bool mb_detect_order(array|string|null $encoding = null) return $return_mb_detect_order; // array|bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_DETECT_ORDER // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_ENCODE_MIMEHEADER // ============================== PUBLIC // ============================== ABOUT // Encode string for MIME header. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_encode_mimeheader() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_encode_mimeheader($string, $charset = null, $transfer_encoding = null, $newline = "\r\n", $indent = 0) { $return_mb_encode_mimeheader = null; // ========== MB_ENCODE_MIMEHEADER - BEGIN // ===== ABOUT // Encode string for MIME header // ===== DESCRIPTION // Encodes a given string string by the MIME header encoding scheme. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_encode_mimeheader( // string $string, // ?string $charset = null, // ?string $transfer_encoding = null, // string $newline = "\r\n", // int $indent = 0 // ): string // ===== CODE $return_mb_encode_mimeheader = mb_encode_mimeheader( $string, // string string - The string being encoded. Its encoding should be same as mb_internal_encoding(). $charset, // string charset - charset specifies the name of the character set in which string is represented in. The default value is determined by the current NLS setting (mbstring.language). $transfer_encoding, // string transfer_encoding - transfer_encoding specifies the scheme of MIME encoding. It should be either "B" (Base64) or "Q" (Quoted-Printable). Falls back to "B" if not given. $newline, // string newline - newline specifies the EOL (end-of-line) marker with which mb_encode_mimeheader() performs line-folding (a > RFC term, the act of breaking a line longer than a certain length into multiple lines. The length is currently hard-coded to 74 characters). Falls back to "\r\n" (CRLF) if not given. $indent // int indent - Indentation of the first line (number of characters in the header before string). ); // Return Values // A converted version of the string represented in ASCII. // // Changelog // Version - Description // 8.0.0 - charset and transfer_encoding are nullable now. // // [examples] // Examples // [example] // Example #1 mb_encode_mimeheader() example // [php] // $name = "太郎"; // kanji // $mbox = "kru"; // $doma = "gtinn.mon"; // $addr = '"' . addcslashes(mb_encode_mimeheader($name, "UTF-7", "Q"), '"') . '" <' . $mbox . "@" . $doma . ">"; // echo $addr; // [/php] // The above example will output: // [result] // "=?UTF-7?Q?+WSqQzg-?=" // [/result] // [/example] // [/examples] // // Notes // Note: This function isn't designed to break lines at higher-level contextual break points (word boundaries, etc.). This behaviour may clutter up the original string with unexpected spaces. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-encode-mimeheader.php // ========== MB_ENCODE_MIMEHEADER - END // SYNTAX: // string mb_encode_mimeheader(string $string, string $charset = null, string $transfer_encoding = null, string $newline = "\r\n", int $indent = 0) return $return_mb_encode_mimeheader; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_ENCODE_MIMEHEADER // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_ENCODE_NUMERICENTITY // ============================== PUBLIC // ============================== ABOUT // Encode character to HTML numeric string reference. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_encode_numericentity() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_encode_numericentity($string, $map, $encoding = null, $hex = false) { $return_mb_encode_numericentity = null; // ========== MB_ENCODE_NUMERICENTITY - BEGIN // ===== ABOUT // Encode character to HTML numeric string reference // ===== DESCRIPTION // Converts specified character codes in string string from character code to HTML numeric character reference. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_encode_numericentity( // string $string, // array $map, // ?string $encoding = null, // bool $hex = false // ): string // ===== CODE $return_mb_encode_numericentity = mb_encode_numericentity( $string, // string string - The string being encoded. $map, // array map - map is array specifies code area to convert. $encoding, // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. $hex // bool hex - Whether the returned entity reference should be in hexadecimal notation (otherwise it is in decimal notation). ); // Return Values // The converted string. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // Example #1 map example // [php] // $convmap = array ( // int start_code1, int end_code1, int offset1, int mask1, // int start_code2, int end_code2, int offset2, int mask2, // ........ // int start_codeN, int end_codeN, int offsetN, int maskN ); // // Specify Unicode value for start_codeN and end_codeN // // Add offsetN to value and take bit-wise 'AND' with maskN, then // // it converts value to numeric string reference. // [/php] // [/example] // [example] // Example #2 mb_encode_numericentity() example // [php] // // Convert Left side of ISO-8859-1 to HTML numeric character reference // $convmap = array(0x80, 0xff, 0, 0xff); // $str = mb_encode_numericentity($str, $convmap, "ISO-8859-1"); // // // Convert user defined SJIS-win code in block 95-104 to numeric // // string reference // $convmap = array( // 0xe000, 0xe03e, 0x1040, 0xffff, // 0xe03f, 0xe0bb, 0x1041, 0xffff, // 0xe0bc, 0xe0fa, 0x1084, 0xffff, // 0xe0fb, 0xe177, 0x1085, 0xffff, // 0xe178, 0xe1b6, 0x10c8, 0xffff, // 0xe1b7, 0xe233, 0x10c9, 0xffff, // 0xe234, 0xe272, 0x110c, 0xffff, // 0xe273, 0xe2ef, 0x110d, 0xffff, // 0xe2f0, 0xe32e, 0x1150, 0xffff, // 0xe32f, 0xe3ab, 0x1151, 0xffff ); // $str = mb_encode_numericentity($str, $convmap, "sjis-win"); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-encode-numericentity.php // ========== MB_ENCODE_NUMERICENTITY - END // SYNTAX: // string mb_encode_numericentity(string $string, array $map, string $encoding = null, bool $hex = false) return $return_mb_encode_numericentity; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_ENCODE_NUMERICENTITY // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_ENCODING_ALIASES // ============================== OFFLINE // ============================== ABOUT // Get aliases of a known encoding type. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_encoding_aliases() - PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_encoding_aliases($encoding) { $return_mb_encoding_aliases = null; // ========== MB_ENCODING_ALIASES - BEGIN // ===== ABOUT // Get aliases of a known encoding type // ===== DESCRIPTION // Returns an array of aliases for a known encoding type. // ===== SUPPORTED // PHP_5 >= PHP_5_3_0, PHP_7, PHP_8 // ===== SYNTAX // mb_encoding_aliases(string $encoding): array // ===== CODE $return_mb_encoding_aliases = mb_encoding_aliases( $encoding // string encoding - The encoding type being checked, for aliases. ); // Return Values // Returns a numerically indexed array of encoding aliases. // // Errors/Exceptions // Throws a ValueError if encoding is unknown. // // Changelog // Version - Description // 8.0.0 - If the encoding is unknown, a ValueError is now thrown; previously an E_WARNING was emitted, and the function returned false. // // [examples] // Examples // [example] // Example #1 mb_encoding_aliases() example // [php] // $encoding = 'ASCII'; // $known_encodings = mb_list_encodings(); // // if (in_array($encoding, $known_encodings)) { // // $aliases = mb_encoding_aliases($encoding); // print_r($aliases); // // } else { // // echo "Unknown ($encoding) encoding.\n"; // // } // [/php] // The above example will output something similar to: // [result] // Array // ( // [0] => ANSI_X3.4-1968 // [1] => iso-ir-6 // [2] => ANSI_X3.4-1986 // [3] => ISO_646.irv:1991 // [4] => US-ASCII // [5] => ISO646-US // [6] => us // [7] => IBM367 // [8] => cp367 // [9] => csASCII // ) // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-encoding-aliases.php // ========== MB_ENCODING_ALIASES - END // SYNTAX: // array mb_encoding_aliases(string $encoding) return $return_mb_encoding_aliases; // array } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_ENCODING_ALIASES // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_MATCH // ============================== PUBLIC // ============================== ABOUT // Regular expression match for multibyte string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_match() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_match($pattern, $string, $options = null) { $return_mb_ereg_match = false; // ========== MB_EREG_MATCH - BEGIN // ===== ABOUT // Regular expression match for multibyte string // ===== DESCRIPTION // A regular expression match for a multibyte string // Note: pattern is only matched at the beginning of string. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_match(string $pattern, string $string, ?string $options = null): bool // ===== CODE $return_mb_ereg_match = mb_ereg_match( $pattern, // string pattern - The regular expression pattern. $string, // string string - The string being evaluated. $options // string options - The search option. See mb_regex_set_options() for explanation. ); // Return Values // Returns true if string matches the regular expression pattern, false if not. // // Changelog // Version - Description // 8.0.0 - options is nullable now. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-match.php // ========== MB_EREG_MATCH - END // SYNTAX: // bool mb_ereg_match(string $pattern, string $string, string $options = null) return $return_mb_ereg_match; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_MATCH // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_REPLACE_CALLBACK // ============================== OFFLINE // ============================== ABOUT // Perform a regular expression search and replace with multibyte support using a callback. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_replace_callback() - PHP_5 >= PHP_5_4_1, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_ereg_replace_callback($pattern, $callback, $string, $options = null) { $return_mb_ereg_replace_callback = false; // ========== MB_EREG_REPLACE_CALLBACK - BEGIN // ===== ABOUT // Perform a regular expression search and replace with multibyte support using a callback // ===== DESCRIPTION // Scans string for matches to pattern, then replaces the matched text with the output of callback function. // The behavior of this function is almost identical to mb_ereg_replace(), except for the fact that instead of replacement parameter, one should specify a callback. // ===== SUPPORTED // PHP_5 >= PHP_5_4_1, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_replace_callback( // string $pattern, // callable $callback, // string $string, // ?string $options = null // ): string|false|null // ===== CODE $return_mb_ereg_replace_callback = mb_ereg_replace_callback( $pattern, // string pattern - The regular expression pattern. // Multibyte characters may be used in pattern. $callback, // callable callback - A callback that will be called and passed an array of matched elements in the subject string. The callback should return the replacement string. // You'll often need the callback function for a mb_ereg_replace_callback() in just one place. In this case you can use an anonymous function to declare the callback within the call to mb_ereg_replace_callback(). By doing it this way you have all information for the call in one place and do not clutter the function namespace with a callback function's name not used anywhere else. $string, // string string - The string being checked. $options // string options - The search option. See mb_regex_set_options() for explanation. ); // Return Values // The resultant string on success, or false on error. If string is not valid for the current encoding, null is returned. // // Changelog // Version - Description // 8.0.0 - options is nullable now. // 7.1.0 - The function checks whether string is valid for the current encoding. // // [examples] // Examples // [example] // Example #1 mb_ereg_replace_callback() example // [php] // // this text was used in 2002 // // we want to get this up to date for 2003 // $text = "April fools day is 04/01/2002\n"; // $text.= "Last christmas was 12/24/2001\n"; // // the callback function // function next_year($matches) // { // // as usual: $matches[0] is the complete match // // $matches[1] the match for the first subpattern // // enclosed in '(...)' and so on // return $matches[1].($matches[2]+1); // } // echo mb_ereg_replace_callback( // "(\d{2}/\d{2}/)(\d{4})", // "next_year", // $text); // // [/php] // The above example will output: // [result] // April fools day is 04/01/2003 // Last christmas was 12/24/2002 // [/result] // [/example] // [example] // Example #2 mb_ereg_replace_callback() using anonymous function // [php] // // this text was used in 2002 // // we want to get this up to date for 2003 // $text = "April fools day is 04/01/2002\n"; // $text.= "Last christmas was 12/24/2001\n"; // // echo mb_ereg_replace_callback( // "(\d{2}/\d{2}/)(\d{4})", // function ($matches) { // return $matches[1].($matches[2]+1); // }, // $text); // [/php] // [/example] // [/examples] // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-ereg-replace-callback.php // ========== MB_EREG_REPLACE_CALLBACK - END // SYNTAX: // string|false|null mb_ereg_replace_callback(string $pattern, callable $callback, string $string, string $options = null) return $return_mb_ereg_replace_callback; // string|false|null } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_REPLACE_CALLBACK // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_REPLACE // ============================== PUBLIC // ============================== ABOUT // Replace regular expression with multibyte support. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_replace() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_replace($pattern, $replacement, $string, $options = null) { $return_mb_ereg_replace = false; // ========== MB_EREG_REPLACE - BEGIN // ===== ABOUT // Replace regular expression with multibyte support // ===== DESCRIPTION // Scans string for matches to pattern, then replaces the matched text with replacement // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_replace( // string $pattern, // string $replacement, // string $string, // ?string $options = null // ): string|false|null // ===== CODE $return_mb_ereg_replace = mb_ereg_replace( $pattern, // string pattern - The regular expression pattern. // Multibyte characters may be used in pattern. $replacement, // string replacement - The replacement text. $string, // string string - The string being checked. $options // string options - The search option. See mb_regex_set_options() for explanation. ); // Return Values // The resultant string on success, or false on error. If string is not valid for the current encoding, null is returned. // // Changelog // Version - Description // 8.0.0 - options is nullable now. // 7.1.0 - The function checks whether string is valid for the current encoding. // 7.1.0 - The e modifier has been deprecated. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // Warning: Never use the e modifier when working on untrusted input. No automatic escaping will happen (as known from preg_replace()). Not taking care of this will most likely create remote code execution vulnerabilities in your application. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-replace.php // ========== MB_EREG_REPLACE - END // SYNTAX: // string|false|null mb_ereg_replace(string $pattern, string $replacement, string $string, string $options = null) return $return_mb_ereg_replace; // string|false|null } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_REPLACE // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_GETPOS // ============================== PUBLIC // ============================== ABOUT // Returns start point for next regular expression match. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_search_getpos() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_search_getpos() { $return_mb_ereg_search_getpos = 0; // ========== MB_EREG_SEARCH_GETPOS - BEGIN // ===== ABOUT // Returns start point for next regular expression match // ===== DESCRIPTION // Returns the start point for the next regular expression match. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_search_getpos(): int // ===== CODE $return_mb_ereg_search_getpos = mb_ereg_search_getpos( // This function has no parameters. ); // Return Values // mb_ereg_search_getpos() returns the point to start regular expression match for mb_ereg_search(), mb_ereg_search_pos(), mb_ereg_search_regs(). The position is represented by bytes from the head of string. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-search-getpos.php // ========== MB_EREG_SEARCH_GETPOS - END // SYNTAX: // int mb_ereg_search_getpos() return $return_mb_ereg_search_getpos; // int } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_GETPOS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_GETREGS // ============================== PUBLIC // ============================== ABOUT // Retrieve the result from the last multibyte regular expression match. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_search_getregs() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_search_getregs() { $return_mb_ereg_search_getregs = false; // ========== MB_EREG_SEARCH_GETREGS - BEGIN // ===== ABOUT // Retrieve the result from the last multibyte regular expression match // ===== DESCRIPTION // Retrieve the result from the last multibyte regular expression match // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_search_getregs(): array|false // ===== CODE $return_mb_ereg_search_getregs = mb_ereg_search_getregs( // This function has no parameters. ); // Return Values // An array including the sub-string of matched part by last mb_ereg_search(), mb_ereg_search_pos(), mb_ereg_search_regs(). If there are some matches, the first element will have the matched sub-string, the second element will have the first part grouped with brackets, the third element will have the second part grouped with brackets, and so on. It returns false on error. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-search-getregs.php // ========== MB_EREG_SEARCH_GETREGS - END // SYNTAX: // array|false mb_ereg_search_getregs() return $return_mb_ereg_search_getregs; // array|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_GETREGS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_INIT // ============================== PUBLIC // ============================== ABOUT // Setup string and regular expression for a multibyte regular expression match. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_search_init() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_search_init($string, $pattern = null, $options = null) { $return_mb_ereg_search_init = false; // ========== MB_EREG_SEARCH_INIT - BEGIN // ===== ABOUT // Setup string and regular expression for a multibyte regular expression match // ===== DESCRIPTION // mb_ereg_search_init() sets string and pattern for a multibyte regular expression. These values are used for mb_ereg_search(), mb_ereg_search_pos(), and mb_ereg_search_regs(). // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_search_init(string $string, ?string $pattern = null, ?string $options = null): bool // ===== CODE $return_mb_ereg_search_init = mb_ereg_search_init( $string, // string string - The search string. $pattern, // string pattern - The search pattern. $options // string options - The search option. See mb_regex_set_options() for explanation. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.0.0 - pattern and options are nullable now. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-search-init.php // ========== MB_EREG_SEARCH_INIT - END // SYNTAX: // bool mb_ereg_search_init(string $string, string $pattern = null, string $options = null) return $return_mb_ereg_search_init; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_INIT // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_POS // ============================== PUBLIC // ============================== ABOUT // Returns position and length of a matched part of the multibyte regular expression for a predefined multibyte string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_search_pos() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_search_pos($pattern = null, $options = null) { $return_mb_ereg_search_pos = false; // ========== MB_EREG_SEARCH_POS - BEGIN // ===== ABOUT // Returns position and length of a matched part of the multibyte regular expression for a predefined multibyte string // ===== DESCRIPTION // Returns position and length of a matched part of the multibyte regular expression for a predefined multibyte string // The string for match is specified by mb_ereg_search_init(). If it is not specified, the previous one will be used. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_search_pos(?string $pattern = null, ?string $options = null): array|false // ===== CODE $return_mb_ereg_search_pos = mb_ereg_search_pos( $pattern, // string pattern - The search pattern. $options // string options - The search option. See mb_regex_set_options() for explanation. ); // Return Values // An array containing two elements. The first element is the offset, in bytes, where the match begins relative to the start of the search string, and the second element is the length in bytes of the match. // If an error occurs, false is returned. // // Changelog // Version - Description // 8.0.0 - pattern and options are nullable now. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-search-pos.php // ========== MB_EREG_SEARCH_POS - END // SYNTAX: // array|false mb_ereg_search_pos(string $pattern = null, string $options = null) return $return_mb_ereg_search_pos; // array|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_POS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_REGS // ============================== PUBLIC // ============================== ABOUT // Returns the matched part of a multibyte regular expression. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_search_regs() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_search_regs($pattern = null, $options = null) { $return_mb_ereg_search_regs = false; // ========== MB_EREG_SEARCH_REGS - BEGIN // ===== ABOUT // Returns the matched part of a multibyte regular expression // ===== DESCRIPTION // Returns the matched part of a multibyte regular expression. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_search_regs(?string $pattern = null, ?string $options = null): array|false // ===== CODE $return_mb_ereg_search_regs = mb_ereg_search_regs( $pattern, // string pattern - The search pattern. $options // string options - The search option. See mb_regex_set_options() for explanation. ); // Return Values // mb_ereg_search_regs() executes the multibyte regular expression match, and if there are some matched part, it returns an array including substring of matched part as first element, the first grouped part with brackets as second element, the second grouped part as third element, and so on. It returns false on error. // // Changelog // Version - Description // 8.0.0 - pattern and options are nullable now. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-search-regs.php // ========== MB_EREG_SEARCH_REGS - END // SYNTAX: // array|false mb_ereg_search_regs(string $pattern = null, string $options = null) return $return_mb_ereg_search_regs; // array|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_REGS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_SETPOS // ============================== PUBLIC // ============================== ABOUT // Set start point of next regular expression match. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_search_setpos() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_search_setpos($offset) { $return_mb_ereg_search_setpos = false; // ========== MB_EREG_SEARCH_SETPOS - BEGIN // ===== ABOUT // Set start point of next regular expression match // ===== DESCRIPTION // mb_ereg_search_setpos() sets the starting point of a match for mb_ereg_search(). // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_search_setpos(int $offset): bool // ===== CODE $return_mb_ereg_search_setpos = mb_ereg_search_setpos( $offset // int offset - The position to set. If it is negative, it counts from the end of the string. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 7.1.0 - Support for negative offsets has been added. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-search-setpos.php // ========== MB_EREG_SEARCH_SETPOS - END // SYNTAX: // bool mb_ereg_search_setpos(int $offset) return $return_mb_ereg_search_setpos; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH_SETPOS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH // ============================== PUBLIC // ============================== ABOUT // Multibyte regular expression match for predefined multibyte string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg_search() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg_search($pattern = null, $options = null) { $return_mb_ereg_search = false; // ========== MB_EREG_SEARCH - BEGIN // ===== ABOUT // Multibyte regular expression match for predefined multibyte string // ===== DESCRIPTION // Performs a multibyte regular expression match for a predefined multibyte string. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg_search(?string $pattern = null, ?string $options = null): bool // ===== CODE $return_mb_ereg_search = mb_ereg_search( $pattern, // string pattern - The search pattern. $options // string options - The search option. See mb_regex_set_options() for explanation. ); // Return Values // mb_ereg_search() returns true if the multibyte string matches with the regular expression, or false otherwise. The string for matching is set by mb_ereg_search_init(). If pattern is not specified, the previous one is used. // // Changelog // Version - Description // 8.0.0 - pattern and options are nullable now. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg-search.php // ========== MB_EREG_SEARCH - END // SYNTAX: // bool mb_ereg_search(string $pattern = null, string $options = null) return $return_mb_ereg_search; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG_SEARCH // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG // ============================== PUBLIC // ============================== ABOUT // Regular expression match with multibyte support. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ereg() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_ereg($pattern, $string, & $matches) { $return_mb_ereg = false; // ========== MB_EREG - BEGIN // ===== ABOUT // Regular expression match with multibyte support // ===== DESCRIPTION // Executes the regular expression match with multibyte support. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_ereg(string $pattern, string $string, array &$matches = null): bool // ===== CODE $return_mb_ereg = mb_ereg( $pattern, // string pattern - The search pattern. $string, // string string - The search string. $matches // array& matches - If matches are found for parenthesized substrings of pattern and the function is called with the third argument matches, the matches will be stored in the elements of the array matches. If no matches are found, matches is set to an empty array. // $matches[1] will contain the substring which starts at the first left parenthesis; $matches[2] will contain the substring starting at the second, and so on. $matches[0] will contain a copy of the complete string matched. ); // Return Values // Returns whether pattern matches string. // // Changelog // Version - Description // 8.0.0 - This function returns true on success now. Previously, it returned the byte length of the matched string if a match for pattern was found in string and matches was passed. If the optional parameter matches was not passed or the length of the matched string was 0, this function returned 1. // 7.1.0 - mb_ereg() will now set matches to an empty array, if nothing matched. Formerly, matches was not modified in that case. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-ereg.php // ========== MB_EREG - END // SYNTAX: // bool mb_ereg(string $pattern, string $string, array& $matches) return $return_mb_ereg; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREG // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREGI_REPLACE // ============================== PUBLIC // ============================== ABOUT // Replace regular expression with multibyte support ignoring case. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_eregi_replace() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_eregi_replace($pattern, $replacement, $string, $options = null) { $return_mb_eregi_replace = false; // ========== MB_EREGI_REPLACE - BEGIN // ===== ABOUT // Replace regular expression with multibyte support ignoring case // ===== DESCRIPTION // Scans string for matches to pattern, then replaces the matched text with replacement. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_eregi_replace( // string $pattern, // string $replacement, // string $string, // ?string $options = null // ): string|false|null // ===== CODE $return_mb_eregi_replace = mb_eregi_replace( $pattern, // string pattern - The regular expression pattern. Multibyte characters may be used. The case will be ignored. $replacement, // string replacement - The replacement text. $string, // string string - The searched string. $options // string options - The search option. See mb_regex_set_options() for explanation. ); // Return Values // The resultant string or false on error. If string is not valid for the current encoding, null is returned. // // Changelog // Version - Description // 8.0.0 - options is nullable now. // 7.1.0 - The function checks whether string is valid for the current encoding. // 7.1.0 - The e modifier has been deprecated. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // Warning: Never use the e modifier when working on untrusted input. No automatic escaping will happen (as known from preg_replace()). Not taking care of this will most likely create remote code execution vulnerabilities in your application. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-eregi-replace.php // ========== MB_EREGI_REPLACE - END // SYNTAX: // string|false|null mb_eregi_replace(string $pattern, string $replacement, string $string, string $options = null) return $return_mb_eregi_replace; // string|false|null } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREGI_REPLACE // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREGI // ============================== PUBLIC // ============================== ABOUT // Regular expression match ignoring case with multibyte support. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_eregi() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_eregi($pattern, $string, & $matches) { $return_mb_eregi = false; // ========== MB_EREGI - BEGIN // ===== ABOUT // Regular expression match ignoring case with multibyte support // ===== DESCRIPTION // Executes the case insensitive regular expression match with multibyte support. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_eregi(string $pattern, string $string, array &$matches = null): bool // ===== CODE $return_mb_eregi = mb_eregi( $pattern, // string pattern - The regular expression pattern. $string, // string string - The string being searched. $matches // array& matches - If matches are found for parenthesized substrings of pattern and the function is called with the third argument matches, the matches will be stored in the elements of the array matches. If no matches are found, matches is set to an empty array. // $matches[1] will contain the substring which starts at the first left parenthesis; $matches[2] will contain the substring starting at the second, and so on. $matches[0] will contain a copy of the complete string matched. ); // Return Values // Returns whether pattern matches string. // // Changelog // Version - Description // 8.0.0 - This function returns true on success now. Previously, it returned the byte length of the matched string if a match for pattern was found in string and matches was passed. If the optional parameter matches was not passed or the length of the matched string was 0, this function returned 1. // 7.1.0 - mb_eregi() will now set matches to an empty array, if nothing matched. Formerly, matches was not modified in that case. // // Notes // Note: The internal encoding or the character encoding specified by mb_regex_encoding() will be used as the character encoding for this function. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-eregi.php // ========== MB_EREGI - END // SYNTAX: // bool mb_eregi(string $pattern, string $string, array& $matches) return $return_mb_eregi; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_EREGI // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_GET_INFO // ============================== PUBLIC // ============================== ABOUT // Get internal settings of mbstring. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_get_info() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_get_info($type = "all") { $return_mb_get_info = false; // ========== MB_GET_INFO - BEGIN // ===== ABOUT // Get internal settings of mbstring // ===== DESCRIPTION // mb_get_info() returns the internal setting parameters of mbstring. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_get_info(string $type = "all"): array|string|int|false // ===== CODE $return_mb_get_info = mb_get_info( $type // string type - If type is not specified or is specified as "all", "internal_encoding", "http_input", "http_output", "http_output_conv_mimetypes", "mail_charset", "mail_header_encoding", "mail_body_encoding", "illegal_chars", "encoding_translation", "language", "detect_order", "substitute_character" and "strict_detection" will be returned. // If type is specified as "internal_encoding", "http_input", "http_output", "http_output_conv_mimetypes", "mail_charset", "mail_header_encoding", "mail_body_encoding", "illegal_chars", "encoding_translation", "language", "detect_order", "substitute_character" or "strict_detection" the specified setting parameter will be returned. ); // Return Values // An array of type information if type is not specified, otherwise a specific type, or false on failure. // // Changelog // Version - Description // 8.0.0 - The types "func_overload" and "func_overload_list" are no longer supported. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-get-info.php // ========== MB_GET_INFO - END // SYNTAX: // array|string|int|false mb_get_info(string $type = "all") return $return_mb_get_info; // array|string|int|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_GET_INFO // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_HTTP_INPUT // ============================== PUBLIC // ============================== ABOUT // Detect HTTP input character encoding. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_http_input() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_http_input($type = null) { $return_mb_http_input = false; // ========== MB_HTTP_INPUT - BEGIN // ===== ABOUT // Detect HTTP input character encoding // ===== DESCRIPTION // Detects the HTTP input character encoding. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_http_input(?string $type = null): array|string|false // ===== CODE $return_mb_http_input = mb_http_input( $type // string type - Input string specifies the input type. "G" for GET, "P" for POST, "C" for COOKIE, "S" for string, "L" for list, and "I" for the whole list (will return array). If type is omitted, it returns the last input type processed. ); // Return Values // The character encoding name, as per the type, or an array of character encoding names, if type is "I". If mb_http_input() does not process specified HTTP input, it returns false. // // Changelog // Version - Description // 8.0.0 - type is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-http-input.php // ========== MB_HTTP_INPUT - END // SYNTAX: // array|string|false mb_http_input(string $type = null) return $return_mb_http_input; // array|string|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_HTTP_INPUT // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_HTTP_OUTPUT // ============================== PUBLIC // ============================== ABOUT // Set/Get HTTP output character encoding. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_http_output() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_http_output($encoding = null) { $return_mb_http_output = false; // ========== MB_HTTP_OUTPUT - BEGIN // ===== ABOUT // Set/Get HTTP output character encoding // ===== DESCRIPTION // Set/Get the HTTP output character encoding. Output after this function is called will be converted from the set internal encoding to encoding. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_http_output(?string $encoding = null): string|bool // ===== CODE $return_mb_http_output = mb_http_output( $encoding // string encoding - If encoding is set, mb_http_output() sets the HTTP output character encoding to encoding. // If encoding is omitted, mb_http_output() returns the current HTTP output character encoding. ); // Return Values // If encoding is omitted, mb_http_output() returns the current HTTP output character encoding. Otherwise, Returns true on success or false on failure. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-http-output.php // ========== MB_HTTP_OUTPUT - END // SYNTAX: // string|bool mb_http_output(string $encoding = null) return $return_mb_http_output; // string|bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_HTTP_OUTPUT // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_INTERNAL_ENCODING // ============================== PUBLIC // ============================== ABOUT // Set/Get internal character encoding. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_internal_encoding() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_internal_encoding($encoding = null) { $return_mb_internal_encoding = false; // ========== MB_INTERNAL_ENCODING - BEGIN // ===== ABOUT // Set/Get internal character encoding // ===== DESCRIPTION // Set/Get the internal character encoding // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_internal_encoding(?string $encoding = null): string|bool // ===== CODE $return_mb_internal_encoding = mb_internal_encoding( $encoding // string encoding - encoding is the character encoding name used for the HTTP input character encoding conversion, HTTP output character encoding conversion, and the default character encoding for string functions defined by the mbstring module. You should notice that the internal encoding is totally different from the one for multibyte regex. ); // Return Values // If encoding is set, then Returns true on success or false on failure. In this case, the character encoding for multibyte regex is NOT changed. If encoding is omitted, then the current character encoding name is returned. // // Errors/Exceptions // As of PHP 8.0.0, a ValueError is thrown if the value of encoding is an invalid encoding. Prior to PHP 8.0.0, a E_WARNING was emitted instead. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // 8.0.0 - Now throws a ValueError if encoding is an invalid encoding. Previously a E_WARNING was emitted instead. // // [examples] // Examples // [example] // Example #1 mb_internal_encoding() example // [php] // // Set internal character encoding to UTF-8 // mb_internal_encoding("UTF-8"); // // // Display current internal character encoding // echo mb_internal_encoding(); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-internal-encoding.php // ========== MB_INTERNAL_ENCODING - END // SYNTAX: // string|bool mb_internal_encoding(string $encoding = null) return $return_mb_internal_encoding; // string|bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_INTERNAL_ENCODING // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_LANGUAGE // ============================== PUBLIC // ============================== ABOUT // Set/Get current language. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_language() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_language($language = null) { $return_mb_language = false; // ========== MB_LANGUAGE - BEGIN // ===== ABOUT // Set/Get current language // ===== DESCRIPTION // Set/Get the current language. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_language(?string $language = null): string|bool // ===== CODE $return_mb_language = mb_language( $language // string language - Used for encoding e-mail messages. The valid languages are listed in the following table. mb_send_mail() uses this setting to encode e-mail. // Language | Charset | Encoding | Alias // German/de | ISO-8859-15 | Quoted-Printable | Deutsch // English/en | ISO-8859-1 | Quoted-Printable | // Armenian/hy | ArmSCII-8 | Quoted-Printable | // Japanese/ja | ISO-2022-JP | BASE64 | // Korean/ko | ISO-2022-KR | BASE64 | // neutral | UTF-8 | BASE64 | // Russian/ru | KOI8-R | Quoted-Printable | // Turkish/tr | ISO-8859-9 | Quoted-Printable | // Ukrainian/ua | KOI8-U | Quoted-Printable | // uni | UTF-8 | BASE64 | universal // Simplified Chinese/zh-cn | HZ | BASE64 | // Traditional Chinese/zh-tw | BIG-5 | BASE64 | ); // Return Values // If language is set and language is valid, it returns true. Otherwise, it returns false. When language is omitted or null, it returns the language name as a string. // // Changelog // Version - Description // 8.0.0 - language is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-language.php // ========== MB_LANGUAGE - END // SYNTAX: // string|bool mb_language(string $language = null) return $return_mb_language; // string|bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_LANGUAGE // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_LIST_ENCODINGS // ============================== OFFLINE // ============================== ABOUT // Returns an array of all supported encodings. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_list_encodings() - PHP_5, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_list_encodings() { $return_mb_list_encodings = null; // ========== MB_LIST_ENCODINGS - BEGIN // ===== ABOUT // Returns an array of all supported encodings // ===== DESCRIPTION // Returns an array containing all supported encodings. // ===== SUPPORTED // PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_list_encodings(): array // ===== CODE $return_mb_list_encodings = mb_list_encodings( // This function has no parameters. ); // Return Values // Returns a numerically indexed array. // // Errors/Exceptions // This function does not emit any errors. // // [examples] // Examples // [example] // Example #1 mb_list_encodings() example // [php] // // print_r(mb_list_encodings()); // // [/php] // The above example will output something similar to: // [result] // Array // ( // [0] => pass // [1] => auto // [2] => wchar // [3] => byte2be // [4] => byte2le // [5] => byte4be // [6] => byte4le // [7] => BASE64 // [8] => UUENCODE // [9] => HTML-ENTITIES // [10] => Quoted-Printable // [11] => 7bit // [12] => 8bit // [13] => UCS-4 // [14] => UCS-4BE // [15] => UCS-4LE // [16] => UCS-2 // [17] => UCS-2BE // [18] => UCS-2LE // [19] => UTF-32 // [20] => UTF-32BE // [21] => UTF-32LE // [22] => UTF-16 // [23] => UTF-16BE // [24] => UTF-16LE // [25] => UTF-8 // [26] => UTF-7 // [27] => UTF7-IMAP // [28] => ASCII // [29] => EUC-JP // [30] => SJIS // [31] => eucJP-win // [32] => SJIS-win // [33] => JIS // [34] => ISO-2022-JP // [35] => Windows-1252 // [36] => ISO-8859-1 // [37] => ISO-8859-2 // [38] => ISO-8859-3 // [39] => ISO-8859-4 // [40] => ISO-8859-5 // [41] => ISO-8859-6 // [42] => ISO-8859-7 // [43] => ISO-8859-8 // [44] => ISO-8859-9 // [45] => ISO-8859-10 // [46] => ISO-8859-13 // [47] => ISO-8859-14 // [48] => ISO-8859-15 // [49] => EUC-CN // [50] => CP936 // [51] => HZ // [52] => EUC-TW // [53] => BIG-5 // [54] => EUC-KR // [55] => UHC // [56] => ISO-2022-KR // [57] => Windows-1251 // [58] => CP866 // [59] => KOI8-R // ) // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-list-encodings.php // ========== MB_LIST_ENCODINGS - END // SYNTAX: // array mb_list_encodings() return $return_mb_list_encodings; // array } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_LIST_ENCODINGS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_ORD // ============================== OFFLINE // ============================== ABOUT // Get Unicode code point of character. // ============================== SUPPORT // PHP_7 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_ord() - PHP_7 >= PHP_7_2_0, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_ord($string, $encoding = null) { $return_mb_ord = false; // ========== MB_ORD - BEGIN // ===== ABOUT // Get Unicode code point of character // ===== DESCRIPTION // Returns the Unicode code point value of the given character. // This function complements mb_chr(). // ===== SUPPORTED // PHP_7 >= PHP_7_2_0, PHP_8 // ===== SYNTAX // mb_ord(string $string, ?string $encoding = null): int|false // ===== CODE $return_mb_ord = mb_ord( $string, // string string - A string $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // The Unicode code point for the first character of string or false on failure. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // [php] // var_dump(mb_ord("A", "UTF-8")); // var_dump(mb_ord("🐘", "UTF-8")); // var_dump(mb_ord("\x80", "ISO-8859-1")); // var_dump(mb_ord("\x80", "Windows-1252")); // [/php] // The above example will output: // [result] // // int(65) // int(128024) // int(128) // int(8364) // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-ord.php // ========== MB_ORD - END // SYNTAX: // int|false mb_ord(string $string, string $encoding = null) return $return_mb_ord; // int|false } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_ORD // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_OUTPUT_HANDLER // ============================== PUBLIC // ============================== ABOUT // Callback function converts character encoding in output buffer. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_output_handler() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_output_handler($string, $status) { $return_mb_output_handler = null; // ========== MB_OUTPUT_HANDLER - BEGIN // ===== ABOUT // Callback function converts character encoding in output buffer // ===== DESCRIPTION // mb_output_handler() is ob_start() callback function. mb_output_handler() converts characters in the output buffer from internal character encoding to HTTP output character encoding. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_output_handler(string $string, int $status): string // ===== CODE $return_mb_output_handler = mb_output_handler( $string, // string string - The contents of the output buffer. $status // int status - The status of the output buffer. ); // Return Values // The converted string. // // [examples] // Examples // [example] // Example #1 mb_output_handler() example // [php] // mb_http_output("UTF-8"); // ob_start("mb_output_handler"); // [/php] // [/example] // [/examples] // // Notes // Note: // If you want to output binary data, such as an image, a Content-Type: header must be set using header() before any binary data is sent to the client (e.g. header("Content-Type: image/png")). If Content-Type: header is sent, output character encoding conversion will not be performed. // Note that if 'Content-Type: text/*' is sent, the content body is regarded as text; conversion will take place. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-output-handler.php // ========== MB_OUTPUT_HANDLER - END // SYNTAX: // string mb_output_handler(string $string, int $status) return $return_mb_output_handler; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_OUTPUT_HANDLER // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_PARSE_STR // ============================== PUBLIC // ============================== ABOUT // Parse GET/POST/COOKIE data and set global variable. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_parse_str() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_parse_str($string, & $result) { $return_mb_parse_str = false; // ========== MB_PARSE_STR - BEGIN // ===== ABOUT // Parse GET/POST/COOKIE data and set global variable // ===== DESCRIPTION // Parses GET/POST/COOKIE data and sets global variables. Since PHP does not provide raw POST/COOKIE data, it can only be used for GET data for now. It parses URL encoded data, detects encoding, converts coding to internal encoding and set values to the result array or global variables. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_parse_str(string $string, array &$result): bool // ===== CODE $return_mb_parse_str = mb_parse_str( $string, // string string - The URL encoded data. $result // array& result - An array containing decoded and character encoded converted values. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.0.0 - The second parameter was no longer optional. // 7.2.0 - Calling mb_parse_str() without the second parameter was deprecated. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-parse-str.php // ========== MB_PARSE_STR - END // SYNTAX: // bool mb_parse_str(string $string, array& $result) return $return_mb_parse_str; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_PARSE_STR // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_PREFERRED_MIME_NAME // ============================== PUBLIC // ============================== ABOUT // Get MIME charset string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_preferred_mime_name() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_preferred_mime_name($encoding) { $return_mb_preferred_mime_name = false; // ========== MB_PREFERRED_MIME_NAME - BEGIN // ===== ABOUT // Get MIME charset string // ===== DESCRIPTION // Get a MIME charset string for a specific encoding. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_preferred_mime_name(string $encoding): string|false // ===== CODE $return_mb_preferred_mime_name = mb_preferred_mime_name( $encoding // string encoding - The encoding being checked. ); // Return Values // The MIME charset string for character encoding encoding, or false if no charset is preferred for the given encoding. // // [examples] // Examples // [example] // Example #1 mb_preferred_mime_name() example // [php] // $outputenc = "sjis-win"; // mb_http_output($outputenc); // ob_start("mb_output_handler"); // header("Content-Type: text/html; charset=" . mb_preferred_mime_name($outputenc)); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-preferred-mime-name.php // ========== MB_PREFERRED_MIME_NAME - END // SYNTAX: // string|false mb_preferred_mime_name(string $encoding) return $return_mb_preferred_mime_name; // string|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_PREFERRED_MIME_NAME // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_REGEX_ENCODING // ============================== PUBLIC // ============================== ABOUT // Set/Get character encoding for multibyte regex. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_regex_encoding() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_regex_encoding($encoding = null) { $return_mb_regex_encoding = false; // ========== MB_REGEX_ENCODING - BEGIN // ===== ABOUT // Set/Get character encoding for multibyte regex // ===== DESCRIPTION // Set/Get character encoding for a multibyte regex. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_regex_encoding(?string $encoding = null): string|bool // ===== CODE $return_mb_regex_encoding = mb_regex_encoding( $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // If encoding is set, then Returns true on success or false on failure. In this case, the internal character encoding is NOT changed. If encoding is omitted, then the current character encoding name for a multibyte regex is returned. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-regex-encoding.php // ========== MB_REGEX_ENCODING - END // SYNTAX: // string|bool mb_regex_encoding(string $encoding = null) return $return_mb_regex_encoding; // string|bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_REGEX_ENCODING // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_REGEX_SET_OPTIONS // ============================== PUBLIC // ============================== ABOUT // Set/Get the default options for mbregex functions. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_regex_set_options() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_regex_set_options($options = null) { $return_mb_regex_set_options = null; // ========== MB_REGEX_SET_OPTIONS - BEGIN // ===== ABOUT // Set/Get the default options for mbregex functions // ===== DESCRIPTION // Sets the default options described by options for multibyte regex functions. // ===== SUPPORTED // PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_regex_set_options(?string $options = null): string // ===== CODE $return_mb_regex_set_options = mb_regex_set_options( $options // string options - The options to set. This is a string where each character is an option. To set a mode, the mode character must be the last one set, however there can only be set one mode but multiple options. // // Regex options // Option | Meaning | Changelog // i | Ambiguity match on | // x | Enables extended pattern form | // m | '.' matches with newlines | // s | '^' -> '\A', '$' -> '\Z' | // p | Same as both the m and s options | // l | Finds longest matches | // n | Ignores empty matches | // e | eval() resulting code | Deprecated as of PHP 7.1.0 and removed as of PHP 8.0.0 // Note: The "e" option has no effect when set through mb_regex_set_options(). Use it with mb_ereg_replace() or mb_eregi_replace(). // // Regex syntax modes (only one may be set) // Mode - Meaning // j - Java (Sun java.util.regex) // u - GNU regex // g - grep // c - Emacs // r - Ruby // z - Perl // b - POSIX Basic regex // d - POSIX Extended regex ); // Return Values // The previous options. If options is omitted or null, it returns the string that describes the current options. // // Changelog // Version - Description // 8.0.0 - If the parameter options is given and not null, the previous options are returned. Formerly, the current options have been returned. // 8.0.0 - options is nullable now. // 8.0.0 - The "e" option now throws a ValueError. // 7.1.0 - The "e" option now emits an E_DEPRECATED. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-regex-set-options.php // ========== MB_REGEX_SET_OPTIONS - END // SYNTAX: // string mb_regex_set_options(string $options = null) return $return_mb_regex_set_options; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_REGEX_SET_OPTIONS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_SCRUB // ============================== OFFLINE // ============================== ABOUT // Replace ill-formed byte sequences with the substitute character. // ============================== SUPPORT // PHP_7 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_scrub() - PHP_7 >= PHP_7_2_0, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_scrub($string, $encoding = null) { $return_mb_scrub = null; // ========== MB_SCRUB - BEGIN // ===== ABOUT // Replace ill-formed byte sequences with the substitute character // ===== DESCRIPTION // Perform a character set conversion from the specified encoding, or the default encoding if no encoding was specified, to the same encoding. This has the effect of replacing any invalid byte sequences with the substitute character. // ===== SUPPORTED // PHP_7 >= PHP_7_2_0, PHP_8 // ===== SYNTAX // mb_scrub(string $string, ?string $encoding = null): string // ===== CODE $return_mb_scrub = mb_scrub( $string, // string string - The input string. $encoding // string encoding - The encoding used to interpret string. If it is omitted or null, the mbstring.internal_encoding setting will be used if set, otherwise the default_charset setting will be used. ); // Return Values // The string result with invalid byte sequences replaced. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-scrub.php // ========== MB_SCRUB - END // SYNTAX: // string mb_scrub(string $string, string $encoding = null) return $return_mb_scrub; // string } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_SCRUB // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_SEND_MAIL // ============================== PUBLIC // ============================== ABOUT // Send encoded mail. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_send_mail() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_send_mail($to, $subject, $message, $additional_headers = array(), $additional_params = null) { $return_mb_send_mail = false; // ========== MB_SEND_MAIL - BEGIN // ===== ABOUT // Send encoded mail // ===== DESCRIPTION // Sends email. Headers and messages are converted and encoded according to the mb_language() setting. It's a wrapper function for mail(), so see also mail() for details. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_send_mail( // string $to, // string $subject, // string $message, // array|string $additional_headers = [], // ?string $additional_params = null // ): bool // ===== CODE $return_mb_send_mail = mb_send_mail( $to, // string to - The mail addresses being sent to. Multiple recipients may be specified by putting a comma between each address in to. This parameter is not automatically encoded. $subject, // string subject - The subject of the mail. $message, // string message - The message of the mail. $additional_headers, // array|string additional_headers (optional) - String or array to be inserted at the end of the email header. // This is typically used to add extra headers (From, Cc, and Bcc). Multiple extra headers should be separated with a CRLF (\r\n). Validate parameter not to be injected unwanted headers by attackers. // If an array is passed, its keys are the header names and its values are the respective header values. // Note: // When sending mail, the mail must contain a From header. This can be set with the additional_headers parameter, or a default can be set in php.ini. // Failing to do this will result in an error message similar to Warning: mail(): "sendmail_from" not set in php.ini or custom "From:" header missing. The From header sets also Return-Path under Windows. // Note: If messages are not received, try using a LF (\n) only. Some Unix mail transfer agents (most notably > qmail) replace LF by CRLF automatically (which leads to doubling CR if CRLF is used). This should be a last resort, as it does not comply with > RFC 2822. $additional_params // string additional_params - additional_params is a MTA command line parameter. It is useful when setting the correct Return-Path header when using sendmail. // This parameter is escaped by escapeshellcmd() internally to prevent command execution. escapeshellcmd() prevents command execution, but allows to add additional parameters. For security reason, this parameter should be validated. // Since escapeshellcmd() is applied automatically, some characters that are allowed as email addresses by internet RFCs cannot be used. Programs that are required to use these characters mail() cannot be used. // The user that the webserver runs as should be added as a trusted user to the sendmail configuration to prevent a 'X-Warning' header from being added to the message when the envelope sender (-f) is set using this method. For sendmail users, this file is /etc/mail/trusted-users. ); // Return Values // Returns true on success or false on failure. // // Changelog // Version - Description // 8.0.0 - additional_params is nullable now. // 7.2.0 - The additional_headers parameter now also accepts an array. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-send-mail.php // ========== MB_SEND_MAIL - END // SYNTAX: // bool mb_send_mail(string $to, string $subject, string $message, array|string $additional_headers = array(), string $additional_params = null) return $return_mb_send_mail; // bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_SEND_MAIL // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_SPLIT // ============================== PUBLIC // ============================== ABOUT // Split multibyte string using regular expression. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_split() - PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_split($pattern, $string, $limit = -1) { $return_mb_split = false; // ========== MB_SPLIT - BEGIN // ===== ABOUT // Split multibyte string using regular expression // ===== DESCRIPTION // Split a multibyte string using regular expression pattern and returns the result as an array. // ===== SUPPORTED // PHP_4 >= PHP_4_2_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_split(string $pattern, string $string, int $limit = -1): array|false // ===== CODE $return_mb_split = mb_split( $pattern, // string pattern - The regular expression pattern. $string, // string string - The string being split. $limit // int limit - If optional parameter limit is specified, it will be split in limit elements as maximum. ); // Return Values // The result as an array, or false on failure. // // Notes // Note: The character encoding specified by mb_regex_encoding() will be used as the character encoding for this function by default. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-split.php // ========== MB_SPLIT - END // SYNTAX: // array|false mb_split(string $pattern, string $string, int $limit = -1) return $return_mb_split; // array|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_SPLIT // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STR_PAD // ============================== OFFLINE // ============================== ABOUT // Pad a multibyte string to a certain length with another multibyte string. // ============================== SUPPORT // PHP_8 // ============================== USING FUNCTIONS (1) // mb_str_pad() - PHP_8 >= PHP_8_3_0 // ============================== USING CONSTANTS (1) // STR_PAD_RIGHT - mb_str_pad() // ============================== CODE /* function php_language_multibytestring_mb_str_pad($string, $length, $pad_string = " ", $pad_type = STR_PAD_RIGHT, $encoding = null) { $return_mb_str_pad = null; // ========== MB_STR_PAD - BEGIN // ===== ABOUT // Pad a multibyte string to a certain length with another multibyte string // ===== DESCRIPTION // This function returns the string padded on the left, the right, or both sides to the specified padding length, where the length is measured in Unicode codepoints. If the optional argument pad_string is not supplied, the string is padded with spaces, otherwise it is padded with characters from pad_string up to the limit. // ===== SUPPORTED // PHP_8 >= PHP_8_3_0 // ===== SYNTAX // mb_str_pad( // string $string, // int $length, // string $pad_string = " ", // int $pad_type = STR_PAD_RIGHT, // ?string $encoding = null // ): string // ===== CODE $return_mb_str_pad = mb_str_pad( $string, // string string - The input string. $length, // int length - If the value of length is negative, less than, or equal to the length of the input string, no padding takes place, and string will be returned. $pad_string, // string pad_string - // Note: The pad_string may be truncated if the required number of padding characters can't be evenly divided by the pad_string's length. $pad_type, // int pad_type - Optional argument pad_type can be STR_PAD_RIGHT, STR_PAD_LEFT, or STR_PAD_BOTH. By default STR_PAD_RIGHT. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // Returns the padded string. // // [examples] // Examples // [example] // Example #1 mb_str_pad() example // [php] // var_dump(mb_str_pad('▶▶', 6, '❤❓❇', STR_PAD_RIGHT)); // string(18) "▶▶❤❓❇❤" // var_dump(mb_str_pad('▶▶', 6, '❤❓❇', STR_PAD_LEFT)); // string(18) "❤❓❇❤▶▶" // var_dump(mb_str_pad('▶▶', 6, '❤❓❇', STR_PAD_BOTH)); // string(18) "❤❓▶▶❤❓" // // var_dump(mb_str_pad("🎉", 3, "祝", STR_PAD_LEFT)); // string(10) "祝祝🎉" // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-str-pad.php // ========== MB_STR_PAD - END // SYNTAX: // string mb_str_pad(string $string, int $length, string $pad_string = " ", int $pad_type = STR_PAD_RIGHT, string $encoding = null) return $return_mb_str_pad; // string } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STR_PAD // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STR_SPLIT // ============================== OFFLINE // ============================== ABOUT // Given a multibyte string, return an array of its characters. // ============================== SUPPORT // PHP_7 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_str_split() - PHP_7 >= PHP_7_4_0, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_str_split($string, $length = 1, $encoding = null) { $return_mb_str_split = null; // ========== MB_STR_SPLIT - BEGIN // ===== ABOUT // Given a multibyte string, return an array of its characters // ===== DESCRIPTION // This function will return an array of strings, it is a version of str_split() with support for encodings of variable character size as well as fixed-size encodings of 1,2 or 4 byte characters. If the length parameter is specified, the string is broken down into chunks of the specified length in characters (not bytes). The encoding parameter can be optionally specified and it is good practice to do so. // ===== SUPPORTED // PHP_7 >= PHP_7_4_0, PHP_8 // ===== SYNTAX // mb_str_split(string $string, int $length = 1, ?string $encoding = null): array // ===== CODE $return_mb_str_split = mb_str_split( $string, // string string - The string to split into characters or chunks. $length, // int length - If specified, each element of the returned array will be composed of multiple characters instead of a single character. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. // A string specifying one of the supported encodings. ); // Return Values // mb_str_split() returns an array of strings. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // 8.0.0 - This function no longer returns false on failure. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-str-split.php // ========== MB_STR_SPLIT - END // SYNTAX: // array mb_str_split(string $string, int $length = 1, string $encoding = null) return $return_mb_str_split; // array } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STR_SPLIT // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRCUT // ============================== PUBLIC // ============================== ABOUT // Get part of string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strcut() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_strcut($string, $start, $length = null, $encoding = null) { $return_mb_strcut = null; // ========== MB_STRCUT - BEGIN // ===== ABOUT // Get part of string // ===== DESCRIPTION // mb_strcut() extracts a substring from a string similarly to mb_substr(), but operates on bytes instead of characters. If the cut position happens to be between two bytes of a multi-byte character, the cut is performed starting from the first byte of that character. This is also the difference to the substr() function, which would simply cut the string between the bytes and thus result in a malformed byte sequence. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_strcut( // string $string, // int $start, // ?int $length = null, // ?string $encoding = null // ): string // ===== CODE $return_mb_strcut = mb_strcut( $string, // string string - The string being cut. $start, // int start - If start is non-negative, the returned string will start at the start'th byte position in string, counting from zero. For instance, in the string 'abcdef', the byte at position 0 is 'a', the byte at position 2 is 'c', and so forth. // If start is negative, the returned string will start at the start'th byte counting back from the end of string. However, if the magnitude of a negative start is greater than the length of the string, the returned portion will start from the beginning of string. $length, // int length - Length in bytes. If omitted or NULL is passed, extract all bytes to the end of the string. // If length is negative, the returned string will end at the length'th byte counting back from the end of string. However, if the magnitude of a negative length is greater than the number of characters after the start position, an empty string will be returned. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // mb_strcut() returns the portion of string specified by the start and length parameters. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-strcut.php // ========== MB_STRCUT - END // SYNTAX: // string mb_strcut(string $string, int $start, int $length = null, string $encoding = null) return $return_mb_strcut; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRCUT // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRIMWIDTH // ============================== PUBLIC // ============================== ABOUT // Get truncated string with specified width. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strimwidth() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_strimwidth($string, $start, $width, $trim_marker = "", $encoding = null) { $return_mb_strimwidth = null; // ========== MB_STRIMWIDTH - BEGIN // ===== ABOUT // Get truncated string with specified width // ===== DESCRIPTION // Truncates string string to specified width, where halfwidth characters count as 1, and fullwidth characters count as 2. See > http://www.unicode.org/reports/tr11/ for details regarding East Asian character widths. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_strimwidth( // string $string, // int $start, // int $width, // string $trim_marker = "", // ?string $encoding = null // ): string // ===== CODE $return_mb_strimwidth = mb_strimwidth( $string, // string string - The string being decoded. $start, // int start - The start position offset. Number of characters from the beginning of string (first character is 0), or if start is negative, number of characters from the end of the string. $width, // int width - The width of the desired trim. If negative width is specified, count from the end of the string. // Note: Passing negative width is deprecated as of PHP 8.3.0. $trim_marker, // string trim_marker - A string that is added to the end of string when string is truncated. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // The truncated string. If trim_marker is set, trim_marker replaces the last chars to match the width. // // Changelog // Version - Description // 8.3.0 - Passing a negative width to mb_strimwidth() is now deprecated. // 8.0.0 - encoding is nullable now. // 7.1.0 - Support for negative starts and widths has been added. // // [examples] // Examples // [example] // Example #1 mb_strimwidth() example // [php] // echo mb_strimwidth("Hello World", 0, 10, "..."); // // output: "Hello W..." // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-strimwidth.php // ========== MB_STRIMWIDTH - END // SYNTAX: // string mb_strimwidth(string $string, int $start, int $width, string $trim_marker = "", string $encoding = null) return $return_mb_strimwidth; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRIMWIDTH // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRIPOS // ============================== OFFLINE // ============================== ABOUT // Finds position of first occurrence of a string within another, case insensitive. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_stripos() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_stripos($haystack, $needle, $offset = 0, $encoding = null) { $return_mb_stripos = false; // ========== MB_STRIPOS - BEGIN // ===== ABOUT // Finds position of first occurrence of a string within another, case insensitive // ===== DESCRIPTION // mb_stripos() returns the numeric position of the first occurrence of needle in the haystack string. Unlike mb_strpos(), mb_stripos() is case-insensitive. If needle is not found, it returns false. // ===== SUPPORTED // PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ===== SYNTAX // mb_stripos( // string $haystack, // string $needle, // int $offset = 0, // ?string $encoding = null // ): int|false // ===== CODE $return_mb_stripos = mb_stripos( $haystack, // string haystack - The string from which to get the position of the first occurrence of needle $needle, // string needle - The string to find in haystack $offset, // int offset - The position in haystack to start searching. A negative offset counts from the end of the string. $encoding // string encoding - Character encoding name to use. If it is omitted, internal character encoding is used. ); // Return Values // Return the numeric position of the first occurrence of needle in the haystack string, or false if needle is not found. // // Changelog // Version - Description // 8.0.0 - needle now accepts an empty string. // 8.0.0 - encoding is nullable now. // 7.1.0 - Support for negative offsets has been added. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-stripos.php // ========== MB_STRIPOS - END // SYNTAX: // int|false mb_stripos(string $haystack, string $needle, int $offset = 0, string $encoding = null) return $return_mb_stripos; // int|false } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRIPOS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRISTR // ============================== OFFLINE // ============================== ABOUT // Finds first occurrence of a string within another, case insensitive. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_stristr() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_stristr($haystack, $needle, $before_needle = false, $encoding = null) { $return_mb_stristr = false; // ========== MB_STRISTR - BEGIN // ===== ABOUT // Finds first occurrence of a string within another, case insensitive // ===== DESCRIPTION // mb_stristr() finds the first occurrence of needle in haystack and returns the portion of haystack. Unlike mb_strstr(), mb_stristr() is case-insensitive. If needle is not found, it returns false. // ===== SUPPORTED // PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ===== SYNTAX // mb_stristr( // string $haystack, // string $needle, // bool $before_needle = false, // ?string $encoding = null // ): string|false // ===== CODE $return_mb_stristr = mb_stristr( $haystack, // string haystack - The string from which to get the first occurrence of needle $needle, // string needle - The string to find in haystack $before_needle, // bool before_needle - Determines which portion of haystack this function returns. If set to true, it returns all of haystack from the beginning to the first occurrence of needle (excluding needle). If set to false, it returns all of haystack from the first occurrence of needle to the end (including needle). $encoding // string encoding - Character encoding name to use. If it is omitted, internal character encoding is used. ); // Return Values // Returns the portion of haystack, or false if needle is not found. // // Changelog // Version - Description // 8.0.0 - needle now accepts an empty string. // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-stristr.php // ========== MB_STRISTR - END // SYNTAX: // string|false mb_stristr(string $haystack, string $needle, bool $before_needle = false, string $encoding = null) return $return_mb_stristr; // string|false } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRISTR // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRLEN // ============================== PUBLIC // ============================== ABOUT // Get string length. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strlen() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_strlen($string, $encoding = null) { $return_mb_strlen = 0; // ========== MB_STRLEN - BEGIN // ===== ABOUT // Get string length // ===== DESCRIPTION // Gets the length of a string. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_strlen(string $string, ?string $encoding = null): int // ===== CODE $return_mb_strlen = mb_strlen( $string, // string string - The string being checked for length. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // Returns the number of characters in string string having character encoding encoding. A multi-byte character is counted as 1. // // Errors/Exceptions // If the encoding is unknown, an error of level E_WARNING is generated. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-strlen.php // ========== MB_STRLEN - END // SYNTAX: // int mb_strlen(string $string, string $encoding = null) return $return_mb_strlen; // int } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRLEN // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRPOS // ============================== PUBLIC // ============================== ABOUT // Find position of first occurrence of string in a string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strpos() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_strpos($haystack, $needle, $offset = 0, $encoding = null) { $return_mb_strpos = false; // ========== MB_STRPOS - BEGIN // ===== ABOUT // Find position of first occurrence of string in a string // ===== DESCRIPTION // Finds position of the first occurrence of a string in a string. // Performs a multi-byte safe strpos() operation based on number of characters. The first character's position is 0, the second character position is 1, and so on. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_strpos( // string $haystack, // string $needle, // int $offset = 0, // ?string $encoding = null // ): int|false // ===== CODE $return_mb_strpos = mb_strpos( $haystack, // string haystack - The string being checked. $needle, // string needle - The string to find in haystack. In contrast with strpos(), numeric values are not applied as the ordinal value of a character. $offset, // int offset - The search offset. If it is not specified, 0 is used. A negative offset counts from the end of the string. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // Returns the numeric position of the first occurrence of needle in the haystack string. If needle is not found, it returns false. // // Changelog // Version - Description // 8.0.0 - needle now accepts an empty string. // 8.0.0 - encoding is nullable now. // 7.1.0 - Support for negative offsets has been added. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-strpos.php // ========== MB_STRPOS - END // SYNTAX: // int|false mb_strpos(string $haystack, string $needle, int $offset = 0, string $encoding = null) return $return_mb_strpos; // int|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRPOS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRRCHR // ============================== OFFLINE // ============================== ABOUT // Finds the last occurrence of a character in a string within another. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strrchr() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_strrchr($haystack, $needle, $before_needle = false, $encoding = null) { $return_mb_strrchr = false; // ========== MB_STRRCHR - BEGIN // ===== ABOUT // Finds the last occurrence of a character in a string within another // ===== DESCRIPTION // mb_strrchr() finds the last occurrence of needle in haystack and returns the portion of haystack. If needle is not found, it returns false. // ===== SUPPORTED // PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ===== SYNTAX // mb_strrchr( // string $haystack, // string $needle, // bool $before_needle = false, // ?string $encoding = null // ): string|false // ===== CODE $return_mb_strrchr = mb_strrchr( $haystack, // string haystack - The string from which to get the last occurrence of needle $needle, // string needle - The string to find in haystack $before_needle, // bool before_needle - Determines which portion of haystack this function returns. If set to true, it returns all of haystack from the beginning to the last occurrence of needle. If set to false, it returns all of haystack from the last occurrence of needle to the end, $encoding // string encoding - Character encoding name to use. If it is omitted, internal character encoding is used. ); // Return Values // Returns the portion of haystack. or false if needle is not found. // // Changelog // Version - Description // 8.0.0 - needle now accepts an empty string. // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-strrchr.php // ========== MB_STRRCHR - END // SYNTAX: // string|false mb_strrchr(string $haystack, string $needle, bool $before_needle = false, string $encoding = null) return $return_mb_strrchr; // string|false } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRRCHR // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRRICHR // ============================== OFFLINE // ============================== ABOUT // Finds the last occurrence of a character in a string within another, case insensitive. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strrichr() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_strrichr($haystack, $needle, $before_needle = false, $encoding = null) { $return_mb_strrichr = false; // ========== MB_STRRICHR - BEGIN // ===== ABOUT // Finds the last occurrence of a character in a string within another, case insensitive // ===== DESCRIPTION // mb_strrichr() finds the last occurrence of needle in haystack and returns the portion of haystack. Unlike mb_strrchr(), mb_strrichr() is case-insensitive. If needle is not found, it returns false. // ===== SUPPORTED // PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ===== SYNTAX // mb_strrichr( // string $haystack, // string $needle, // bool $before_needle = false, // ?string $encoding = null // ): string|false // ===== CODE $return_mb_strrichr = mb_strrichr( $haystack, // string haystack - The string from which to get the last occurrence of needle $needle, // string needle - The string to find in haystack $before_needle, // bool before_needle - Determines which portion of haystack this function returns. If set to true, it returns all of haystack from the beginning to the last occurrence of needle. If set to false, it returns all of haystack from the last occurrence of needle to the end, $encoding // string encoding - Character encoding name to use. If it is omitted, internal character encoding is used. ); // Return Values // Returns the portion of haystack. or false if needle is not found. // // Changelog // Version - Description // 8.0.0 - needle now accepts an empty string. // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-strrichr.php // ========== MB_STRRICHR - END // SYNTAX: // string|false mb_strrichr(string $haystack, string $needle, bool $before_needle = false, string $encoding = null) return $return_mb_strrichr; // string|false } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRRICHR // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRRIPOS // ============================== OFFLINE // ============================== ABOUT // Finds position of last occurrence of a string within another, case insensitive. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strripos() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_strripos($haystack, $needle, $offset = 0, $encoding = null) { $return_mb_strripos = false; // ========== MB_STRRIPOS - BEGIN // ===== ABOUT // Finds position of last occurrence of a string within another, case insensitive // ===== DESCRIPTION // mb_strripos() performs multi-byte safe strripos() operation based on number of characters. needle position is counted from the beginning of haystack. First character's position is 0. Second character position is 1. Unlike mb_strrpos(), mb_strripos() is case-insensitive. // ===== SUPPORTED // PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ===== SYNTAX // mb_strripos( // string $haystack, // string $needle, // int $offset = 0, // ?string $encoding = null // ): int|false // ===== CODE $return_mb_strripos = mb_strripos( $haystack, // string haystack - The string from which to get the position of the last occurrence of needle $needle, // string needle - The string to find in haystack $offset, // int offset - The position in haystack to start searching $encoding // string encoding - Character encoding name to use. If it is omitted, internal character encoding is used. ); // Return Values // Return the numeric position of the last occurrence of needle in the haystack string, or false if needle is not found. // // Changelog // Version - Description // 8.0.0 - needle now accepts an empty string. // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-strripos.php // ========== MB_STRRIPOS - END // SYNTAX: // int|false mb_strripos(string $haystack, string $needle, int $offset = 0, string $encoding = null) return $return_mb_strripos; // int|false } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRRIPOS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRRPOS // ============================== PUBLIC // ============================== ABOUT // Find position of last occurrence of a string in a string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strrpos() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_strrpos($haystack, $needle, $offset = 0, $encoding = null) { $return_mb_strrpos = false; // ========== MB_STRRPOS - BEGIN // ===== ABOUT // Find position of last occurrence of a string in a string // ===== DESCRIPTION // Performs a multibyte safe strrpos() operation based on the number of characters. needle position is counted from the beginning of haystack. First character's position is 0. Second character position is 1. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_strrpos( // string $haystack, // string $needle, // int $offset = 0, // ?string $encoding = null // ): int|false // ===== CODE $return_mb_strrpos = mb_strrpos( $haystack, // string haystack - The string being checked, for the last occurrence of needle $needle, // string needle - The string to find in haystack. $offset, // int offset - May be specified to begin searching an arbitrary number of characters into the string. Negative values will stop searching at an arbitrary point prior to the end of the string. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // Returns the numeric position of the last occurrence of needle in the haystack string. If needle is not found, it returns false. // // Changelog // Version - Description // 8.0.0 - needle now accepts an empty string. // 8.0.0 - Passing the encoding as the third argument instead of an offset has been removed. // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-strrpos.php // ========== MB_STRRPOS - END // SYNTAX: // int|false mb_strrpos(string $haystack, string $needle, int $offset = 0, string $encoding = null) return $return_mb_strrpos; // int|false } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRRPOS // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRSTR // ============================== OFFLINE // ============================== ABOUT // Finds first occurrence of a string within another. // ============================== SUPPORT // PHP_5 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strstr() - PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ============================== CODE /* function php_language_multibytestring_mb_strstr($haystack, $needle, $before_needle = false, $encoding = null) { $return_mb_strstr = false; // ========== MB_STRSTR - BEGIN // ===== ABOUT // Finds first occurrence of a string within another // ===== DESCRIPTION // mb_strstr() finds the first occurrence of needle in haystack and returns the portion of haystack. If needle is not found, it returns false. // ===== SUPPORTED // PHP_5 >= PHP_5_2_0, PHP_7, PHP_8 // ===== SYNTAX // mb_strstr( // string $haystack, // string $needle, // bool $before_needle = false, // ?string $encoding = null // ): string|false // ===== CODE $return_mb_strstr = mb_strstr( $haystack, // string haystack - The string from which to get the first occurrence of needle $needle, // string needle - The string to find in haystack $before_needle, // bool before_needle - Determines which portion of haystack this function returns. If set to true, it returns all of haystack from the beginning to the first occurrence of needle (excluding needle). If set to false, it returns all of haystack from the first occurrence of needle to the end (including needle). $encoding // string encoding - Character encoding name to use. If it is omitted, internal character encoding is used. ); // Return Values // Returns the portion of haystack, or false if needle is not found. // // Changelog // Version - Description // 8.0.0 - needle now accepts an empty string. // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-strstr.php // ========== MB_STRSTR - END // SYNTAX: // string|false mb_strstr(string $haystack, string $needle, bool $before_needle = false, string $encoding = null) return $return_mb_strstr; // string|false } */ // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRSTR // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRTOLOWER // ============================== PUBLIC // ============================== ABOUT // Make a string lowercase. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strtolower() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_strtolower($string, $encoding = null) { $return_mb_strtolower = null; // ========== MB_STRTOLOWER - BEGIN // ===== ABOUT // Make a string lowercase // ===== DESCRIPTION // Returns string with all alphabetic characters converted to lowercase. // ===== SUPPORTED // PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_strtolower(string $string, ?string $encoding = null): string // ===== CODE $return_mb_strtolower = mb_strtolower( $string, // string string - The string being lowercased. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // string with all alphabetic characters converted to lowercase. // // [examples] // Examples // [example] // Example #1 mb_strtolower() example // [php] // $str = "Mary Had A Little Lamb and She LOVED It So"; // $str = mb_strtolower($str); // echo $str; // Prints mary had a little lamb and she loved it so // [/php] // [/example] // [example] // Example #2 mb_strtolower() example with non-Latin UTF-8 text // [php] // $str = "Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός"; // $str = mb_strtolower($str, 'UTF-8'); // echo $str; // Prints τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός // [/php] // [/example] // [/examples] // // Notes // By contrast to strtolower(), 'alphabetic' is determined by the Unicode character properties. Thus the behaviour of this function is not affected by locale settings and it can convert any characters that have 'alphabetic' property, such as a-umlaut (ä). // For more information about the Unicode properties, please see > http://www.unicode.org/reports/tr21/. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-strtolower.php // ========== MB_STRTOLOWER - END // SYNTAX: // string mb_strtolower(string $string, string $encoding = null) return $return_mb_strtolower; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRTOLOWER // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRTOUPPER // ============================== PUBLIC // ============================== ABOUT // Make a string uppercase. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strtoupper() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_strtoupper($string, $encoding = null) { $return_mb_strtoupper = null; // ========== MB_STRTOUPPER - BEGIN // ===== ABOUT // Make a string uppercase // ===== DESCRIPTION // Returns string with all alphabetic characters converted to uppercase. // ===== SUPPORTED // PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_strtoupper(string $string, ?string $encoding = null): string // ===== CODE $return_mb_strtoupper = mb_strtoupper( $string, // string string - The string being uppercased. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // string with all alphabetic characters converted to uppercase. // // [examples] // Examples // [example] // Example #1 mb_strtoupper() example // [php] // $str = "Mary Had A Little Lamb and She LOVED It So"; // $str = mb_strtoupper($str); // echo $str; // Prints MARY HAD A LITTLE LAMB AND SHE LOVED IT SO // [/php] // [/example] // [example] // Example #2 mb_strtoupper() example with non-Latin UTF-8 text // [php] // $str = "Τάχιστη αλώπηξ βαφής ψημένη γη, δρασκελίζει υπέρ νωθρού κυνός"; // $str = mb_strtoupper($str, 'UTF-8'); // echo $str; // Prints ΤΆΧΙΣΤΗ ΑΛΏΠΗΞ ΒΑΦΉΣ ΨΗΜΈΝΗ ΓΗ, ΔΡΑΣΚΕΛΊΖΕΙ ΥΠΈΡ ΝΩΘΡΟΎ ΚΥΝΌΣ // [/php] // [/example] // [/examples] // // Notes // By contrast to strtoupper(), 'alphabetic' is determined by the Unicode character properties. Thus the behaviour of this function is not affected by locale settings and it can convert any characters that have 'alphabetic' property, such as a-umlaut (ä). // For more information about the Unicode properties, please see > http://www.unicode.org/reports/tr21/. // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-strtoupper.php // ========== MB_STRTOUPPER - END // SYNTAX: // string mb_strtoupper(string $string, string $encoding = null) return $return_mb_strtoupper; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRTOUPPER // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRWIDTH // ============================== PUBLIC // ============================== ABOUT // Return width of string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_strwidth() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_strwidth($string, $encoding = null) { $return_mb_strwidth = 0; // ========== MB_STRWIDTH - BEGIN // ===== ABOUT // Return width of string // ===== DESCRIPTION // Returns the width of string string, where halfwidth characters count as 1, and fullwidth characters count as 2. See > http://www.unicode.org/reports/tr11/ for details regarding East Asian character widths. // The fullwidth characters are: U+1100-U+115F, U+11A3-U+11A7, U+11FA-U+11FF, U+2329-U+232A, U+2E80-U+2E99, U+2E9B-U+2EF3, U+2F00-U+2FD5, U+2FF0-U+2FFB, U+3000-U+303E, U+3041-U+3096, U+3099-U+30FF, U+3105-U+312D, U+3131-U+318E, U+3190-U+31BA, U+31C0-U+31E3, U+31F0-U+321E, U+3220-U+3247, U+3250-U+32FE, U+3300-U+4DBF, U+4E00-U+A48C, U+A490-U+A4C6, U+A960-U+A97C, U+AC00-U+D7A3, U+D7B0-U+D7C6, U+D7CB-U+D7FB, U+F900-U+FAFF, U+FE10-U+FE19, U+FE30-U+FE52, U+FE54-U+FE66, U+FE68-U+FE6B, U+FF01-U+FF60, U+FFE0-U+FFE6, U+1B000-U+1B001, U+1F200-U+1F202, U+1F210-U+1F23A, U+1F240-U+1F248, U+1F250-U+1F251, U+20000-U+2FFFD, U+30000-U+3FFFD. All other characters are halfwidth characters. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_strwidth(string $string, ?string $encoding = null): int // ===== CODE $return_mb_strwidth = mb_strwidth( $string, // string string - The string being decoded. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // The width of string string. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // Example #1 mb_strwidth() example // [php] // var_dump( // mb_strwidth('a'), // LATIN SMALL LETTER A // mb_strwidth("\u{ff41}") // FULLWIDTH LATIN SMALL LETTER A // ); // [/php] // The above example will output: // [result] // int(1) // int(2) // [/result] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-strwidth.php // ========== MB_STRWIDTH - END // SYNTAX: // int mb_strwidth(string $string, string $encoding = null) return $return_mb_strwidth; // int } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_STRWIDTH // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_SUBSTITUTE_CHARACTER // ============================== PUBLIC // ============================== ABOUT // Set/Get substitution character. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_substitute_character() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_substitute_character($substitute_character = null) { $return_mb_substitute_character = false; // ========== MB_SUBSTITUTE_CHARACTER - BEGIN // ===== ABOUT // Set/Get substitution character // ===== DESCRIPTION // Specifies a substitution character when input character encoding is invalid or character code does not exist in output character encoding. Invalid characters may be substituted "none" (no output), string or int value (Unicode character code value). // This setting affects mb_convert_encoding(), mb_convert_variables(), mb_output_handler(), and mb_send_mail(). // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_substitute_character(string|int|null $substitute_character = null): string|int|bool // ===== CODE $return_mb_substitute_character = mb_substitute_character( $substitute_character // string|int|null substitute_character - Specify the Unicode value as an int, or as one of the following strings: // * "none" : no output // * "long" : Output character code value (Example: U+3000, JIS+7E7E) // * "entity" : Output character entity (Example: Ȁ) ); // Return Values // If substitute_character is set, it returns true for success, otherwise returns false. If substitute_character is not set, it returns the current setting. // // Changelog // Version - Description // 8.0.0 - Passing an empty string to substitute_character is no longer supported; "none" should be passed instead. // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // Example #1 mb_substitute_character() example // [php] // // Set with Unicode U+3013 (GETA MARK) // mb_substitute_character(0x3013); // // // Set hex format // mb_substitute_character("long"); // // // Display current setting // echo mb_substitute_character(); // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-substitute-character.php // ========== MB_SUBSTITUTE_CHARACTER - END // SYNTAX: // string|int|bool mb_substitute_character(string|int|null $substitute_character = null) return $return_mb_substitute_character; // string|int|bool } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_SUBSTITUTE_CHARACTER // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_SUBSTR_COUNT // ============================== PUBLIC // ============================== ABOUT // Count the number of substring occurrences. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_substr_count() - PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_substr_count($haystack, $needle, $encoding = null) { $return_mb_substr_count = 0; // ========== MB_SUBSTR_COUNT - BEGIN // ===== ABOUT // Count the number of substring occurrences // ===== DESCRIPTION // Counts the number of times the needle substring occurs in the haystack string. // ===== SUPPORTED // PHP_4 >= PHP_4_3_0, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_substr_count(string $haystack, string $needle, ?string $encoding = null): int // ===== CODE $return_mb_substr_count = mb_substr_count( $haystack, // string haystack - The string being checked. $needle, // string needle - The string being found. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // The number of times the needle substring occurs in the haystack string. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // // [examples] // Examples // [example] // Example #1 mb_substr_count() example // [php] // echo mb_substr_count("This is a test", "is"); // prints out 2 // [/php] // [/example] // [/examples] // ===== LITERATURE_SOURCES // * PHP_NET (2024-01-04) // URL: https://www.php.net/manual/en/function.mb-substr-count.php // ========== MB_SUBSTR_COUNT - END // SYNTAX: // int mb_substr_count(string $haystack, string $needle, string $encoding = null) return $return_mb_substr_count; // int } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_SUBSTR_COUNT // ============================== // ============================== BEGIN // PHP_LANGUAGE_MULTIBYTESTRING_MB_SUBSTR // ============================== PUBLIC // ============================== ABOUT // Get part of string. // ============================== SUPPORT // PHP_4 - PHP_8 // ============================== USING FUNCTIONS (1) // mb_substr() - PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ============================== CODE function php_language_multibytestring_mb_substr($string, $start, $length = null, $encoding = null) { $return_mb_substr = null; // ========== MB_SUBSTR - BEGIN // ===== ABOUT // Get part of string // ===== DESCRIPTION // Performs a multi-byte safe substr() operation based on number of characters. Position is counted from the beginning of string. First character's position is 0. Second character position is 1, and so on. // ===== SUPPORTED // PHP_4 >= PHP_4_0_6, PHP_5, PHP_7, PHP_8 // ===== SYNTAX // mb_substr( // string $string, // int $start, // ?int $length = null, // ?string $encoding = null // ): string // ===== CODE $return_mb_substr = mb_substr( $string, // string string - The string to extract the substring from. $start, // int start - If start is non-negative, the returned string will start at the start'th position in string, counting from zero. For instance, in the string 'abcdef', the character at position 0 is 'a', the character at position 2 is 'c', and so forth. // If start is negative, the returned string will start at the start'th character from the end of string. $length, // int length - Maximum number of characters to use from string. If omitted or NULL is passed, extract all characters to the end of the string. $encoding // string encoding - The encoding parameter is the character encoding. If it is omitted or null, the internal character encoding value will be used. ); // Return Values // mb_substr() returns the portion of string specified by the start and length parameters. // // Changelog // Version - Description // 8.0.0 - encoding is nullable now. // ===== LITERATURE_SOURCES // * PHP_NET (2023-10-01) // URL: https://www.php.net/manual/en/function.mb-substr.php // ========== MB_SUBSTR - END // SYNTAX: // string mb_substr(string $string, int $start, int $length = null, string $encoding = null) return $return_mb_substr; // string } // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING_MB_SUBSTR // ============================== // ============================== END // PHP_LANGUAGE_MULTIBYTESTRING // ============================== ?>