Found 26504 Articles for Server Side Programming

PHP – mb_split (Multibyte Split) function

Urmila Samariya
Updated on 11-Oct-2021 13:28:38

399 Views

The mb_split() function in PHP is used to split a multibyte string using regular expressions. It returns the results in an array format.Syntaxarray mb_split($str_pattern, $str_string, int $limit=-1)Parametersmb_split() accepts the following three parameters −$str_pattern − It is used for the regular expression's pattern.$str_string − It is used to split the string.$limit − It is an optional parameter that is used to specify the limit elements.Return ValuesThe mb_split function will return the split elements result as an array. Or, it will return False on failure.Example 1OutputIt will produce the following output −Array ( [0] => Welcome ... Read More

PHP – mb_preferred_mime_name() function

Urmila Samariya
Updated on 11-Oct-2021 13:26:57

106 Views

The mb_preferred_mime_name() function in PHP is used to return the MIME string for the character encoding and it returns the charset string. It gets a MIME (Multipurpose Internet Mail Extensions) charset string for the specific encoding.Syntaxstring mb_preferred_mime_name($string_encoding)Parametersmb_preferred_mime_name() accepts only one parameter −$string_encoding − This parameter is used to check the encoding.Return ValuesThe mb_preferred_mime_name() function returns the MIME charset string for the charset encoding. It returns False if no charset is preferred for the given encoding.ExampleLet us now take an example and see how it works −OutputIt will produce the following output −EUC-JP Read More

C++ program to search specific values in an array

Arnab Chakraborty
Updated on 11-Oct-2021 14:36:48

4K+ Views

Suppose we are given an array 'arr' that contains n number of sorted integer values. We are also given an array 'query' of size q, and we have to tell either the values in ‘query’ are present in the given array 'arr' or not. If a value in query is present in arr, we print "Present" along with the position where the value is situated in. Otherwise, we print "Not present" and print the position in arr, where the minimum value greater than the value in query is located. We have to remember that the arrays are 1-indexed.So, if the ... Read More

PHP – Parse the GET, POST, and COOKIE data using mb_parse_str()

Urmila Samariya
Updated on 11-Oct-2021 13:25:16

646 Views

The mb_parse_str() function in PHP is used to parse the GET, POST, and COOKIE data and it sets the global variable. It parses the URL encoded data and detects the encoding. After that, it converts the coding in the internal encoding and sets values for the global variables. This function is supported in PHP 7 or higher versions.Syntaxstring mb_parse_str($str_string, $array_result)Parametersmb_parse_str() accepts the following two parameters −$str_string − This parameter is used for the URL encoded data.$result − The result parameter will be an array holding the decrypted and character encrypted converted values.Return ValuesThe mb_parse_str() function returns True on success or ... Read More

PHP – How to get the Unicode point value of a given character?

Urmila Samariya
Updated on 11-Oct-2021 13:22:14

2K+ Views

In PHP, we can use the mb_ord() function to get the Unicode code point value of a given character. This function is supported in PHP 7 or higher versions. The mb_ord() function complements the mc_chr() function.Syntaxint mb_ord($str_string, $str_encoding)Parametersmb_ord() accepts the following two parameters −$str_string − This parameter is used for the string.$str_encoding − This is the character encoding parameter. If it is absent or NULL, then we can use the internal encoding value.Return Valuesmb_ord() returns the Unicode point value for the first character from the given string. It will return False on failure.ExampleOutputIt will produce the following output −Get the ... Read More

PHP – Return an array of all supported encodings with mb_list_encodings()

Urmila Samariya
Updated on 11-Oct-2021 13:17:35

321 Views

The mb_list_encodings() function in PHP is used to return an array of all supported encodings. This function is supported in PHP 5 or higher version.Syntaxarray mb_list_encodings()Parametersmb_list_encodings() takes no parameters.Return ValuesThis function returns a numerically indexed array.Errors/Exceptionsmb_list_encodings() does not produce any errors.Examplemb_list_encodings() does not produce any errors.OutputIt will produce the following output −array(87) {    [0]=> string(4) "pass"    [1]=> string(4) "auto"    [2]=> string(5) "wchar"    [3]=> string(7) "byte2be"    [4]=> string(7) "byte2le"    [5]=> string(7) "byte4be"    [6]=> string(7) "byte4le"    [7]=> string(6) "BASE64"    [8]=> string(8) "UUENCODE"    [9]=> string(13) ... Read More

PHP – Get or set the HTTP output character encoding with mb_http_output()

Urmila Samariya
Updated on 11-Oct-2021 13:11:03

378 Views

The mb_http_output() function in PHP is used to get or set the HTTP output character encoding. An output, after this function is called, will be converted from the set internal encoding to the specified encoding.Syntaxstring|bool mb_http_output(str $encoding = null)Parametersmb_http_output() accepts only a single parameter −$encoding − It is used to set the HTTP output character encoding to the encoding. If the encoding is omitted, then mb_http_output() will return the current HTTP output character encoding.Return ValuesIf the encoding is omitted, then the mb_http_output() function will return the current HTTP output character encoding. Otherwise, it returns True on success and False on ... Read More

PHP – Detect HTTP input character encoding with mb_http_input()

Urmila Samariya
Updated on 11-Oct-2021 13:08:36

596 Views

The mb_http_input() function in PHP is used to detect the HTTP (Hyper-text transfer protocols) input character encoding. This function is supported in PHP 5.4 or higher version.Syntaxarray|string mb_http_input(str $type=null)Parametersmb_http_input() accepts only a single parameter −$type − In the type parameter, the input string specifies the input type, like −G is used for GET, P is used for POST, C is used for COOKIE, S is used for STRING, L is used for LIST, andI for the whole list (it will return array).If the type is omitted, then it returns the last input type processed.Return Valuesmb_http_input() returns the character encoding name ... Read More

PHP – Get the internal settings of mbstring with mb_get_info()

Urmila Samariya
Updated on 11-Oct-2021 13:06:33

155 Views

The mb_get_info() function in PHP is used to get the internal settings of mbstring. This function is supported in PHP 5.4 or higher version.Syntaxarray|string|int mb_get_info(str $type = "all")ParametersIt accepts only a single parameter to get the multibyte information.$type − If the type parameter is not specified or it is specified as "all", then it will return the following information −"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", "strict_detection" If the type parameter is specified as any of the following −"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", then it will ... Read More

PHP – mb_eregi_replace() function

Urmila Samariya
Updated on 11-Oct-2021 13:02:17

238 Views

In PHP, mb_eregi_replace() is used to replace a regular expression with a multibyte support, ignoring case. This function will scan the string for matches to the pattern, then it will replace the matched text with the replacement. This function is supported in PHP 4.2 or higher version.Syntaxstring mb_eregi_replace(str $pattern, str $replacement, str $string, str $options)Parametersmb_eregi_replace() accepts the following four parameters −$pattern − This parameter is used for the regular expression pattern and it may be used multibyte characters. The case will be ignored.$replacement − This parameter is used for text replacement.$string − The string parameter is used to search the ... Read More

Advertisements