Found 26504 Articles for Server Side Programming

PHP – mb_strripos() function

Urmila Samariya
Updated on 12-Oct-2021 06:31:04

176 Views

The mb_strripos() function in PHP is used to search the last existing of a string in another string. This function is not case-sensitive. It performs multi-byte safe strripos() operation based on the number of characters. It returns the specified needle position count from the starting of the haystack string.Syntaxinteger mb_strripos( $str_haystack, $str_needle, $integer_offset=0, $str_encoding )Parametersmb_strripos() accepts the following four parameters −str_haystack − It is the string used to get the position of the last occurrence of the string needle.str_needle − This is used to find the string from ... Read More

C++ program to demonstrate function of macros

Arnab Chakraborty
Updated on 12-Oct-2021 13:48:40

481 Views

Suppose we are given a integer array that contains several integer values. We have to find out the difference between the smallest value and the largest value in the array. To solve this problem, we have to use macros. The inputs are taken from stdin, and the result is printed back to stdout.So, if the input is like array = {120, 589, 324, 221, 234}, then the output will be The answer is : 469The difference between the largest value 589 and the smallest value 120 is 469.To solve this, we will follow these steps −mini := infinitymaxi := negative ... Read More

PHP – mb_strrichr() function

Urmila Samariya
Updated on 11-Oct-2021 13:51:49

129 Views

The mb_strrichr() function in PHP is used to find the last occurrence of a character in a string within another string. This function is not case-sensitive like mb_strrchr(). This function finds the last occurrence of a needle in the given haystack string and returns that portion of the haystack. It returns false if a needle is not found in the haystack string.Syntaxstring mb_strrichr( $str_haystack, $str_needle, $bool_before_needle=false, $str_encoding )Parametersmb_strrichr() accepts the following four parameters −str_haystack − The string from which to get the last occurrence of the needle.str_needle − ... Read More

PHP – mb_eregi() function

Urmila Samariya
Updated on 11-Oct-2021 13:49:04

245 Views

The mb_eregi (multibyte regular expression ignore) function in PHP is used to ignore the regular expression match with multibyte support. This function performs the case-insensitive regular expression match with the multibyte support.Syntaxbool mb_eregi( $str_ pattern, $str_string, $arr_matches=null )For example(pattern = "or", string = "Hello World"); Parametersmb_eregi() accepts the following three parameters −pattern − This parameter matches the pattern in the given string.mb_ereg ("or", "Hello World") // "or" is the pattern that will be matched // in the given string "Hello World".string − This parameter is used to search the string.matches − ... Read More

C++ program to print values in a specified format

Arnab Chakraborty
Updated on 11-Oct-2021 13:52:27

996 Views

Suppose we are given three double values. We have to format them and print them in the following format.We have to print the integer part of the first value in hexadecimal format with lowercase letters.We have to print the second value up to two decimal places, putting a sign before it to show whether it is positive or negative. The second value to be printed has to be rightjustified and 15 characters long, padded with underscores in the left unused positions.We have to print the third value up to nine decimal places in a scientific notation.So, if the input is ... Read More

PHP – mb_strrpos() function

Urmila Samariya
Updated on 11-Oct-2021 13:44:01

318 Views

The mb_strrpos() function in PHP is used to find the position of the last occurrence of a string in another string. This function performs the multibyte safe strrpos() operation based on the number of characters. It counts the needle position from the starting of the haystack string.Syntaxint mb_strrpos( $str_haystack, $str_needle, $int_offset=0, $str_encoding=empty )Parametersmb_strrpos() accepts the following four parameters −$str_haystack − This parameter is used to check the string for the last existence of the needle string.$str_needle − This needle parameter is used to find the string in the ... Read More

PHP – mb_stristr() function

Urmila Samariya
Updated on 11-Oct-2021 13:40:34

161 Views

The mb_stristr() function in PHP is used to search the first existence of a string in another given string; this function is not case-sensitive. mb_stristr() searches for the first existence of the needle in a given haystack string and returns the portion of the haystack. It will return False if the needle is not found.Syntaxstring mb_stristr( $str_haystack, $str_needle, $bool_before_needle=false, $str_encoding=empty )Parametersmb_stristr() accepts the following four parameters −$str_haystack − This parameter is used to get the first existence of the string needle.$str_needle − This parameter is used to find ... Read More

PHP – mb_stripos() function

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

452 Views

The mb_stripos() function in PHP is used to find the position of first occurrence of a string within another string. It is "case-insensitive". mbstripos() returns the numeric position of the first existence of the needle in a given haystack string. If the needle is not found, it will return False.Syntaxinteger mb_stripos($str_haystack, $str_needle, $int_offset=0, $str_ecoding=empty)ParametersIt accepts the following four parameters −$str_haystack − This parameter is used to get the position of the first existence of the needle from the given string.$str_needle − This parameter is used to find the string from the given haystack.$int_offset − This parameter is used to search ... Read More

PHP – mb_strrchr() function

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

145 Views

The mb_strrchr() function in PHP checks the last occurrence of a character in a given string within another string. For example, suppose we have a string "ia" and we need to check it from another given string "PHP tutorials", then the mb_strrchr() function will return the portion of characters till the last existence character "ials". If it is not found, then it will return false.SyntaxString mb_strrchr($str_haystack, $str_needle, $bool_before_needle=false, $str_encoding=empty)Parametersmb_strrchr() accepts the following four parameters −$str_haystack − This parameter is used to get the last existence of the string needle.$str_needle − This parameter is used to find the string in a ... Read More

PHP – mb_strimwidth (multybyte strimwidth) function

Urmila Samariya
Updated on 11-Oct-2021 13:32:09

749 Views

The mb_strimwidth() function in PHP is used to truncate a given string with specified width. It is used to cut out the specified width from a given string.Syntaxstring mb_strimwidth($str_string, $int_start, $int_width, $str_trim_marker, $str_encoding)For example, mb_strimwidth($str_string: "PHP Tutorials", $int_start: 2, $int_width: 10, $str_trim_marker: "...", ); Parametersmb_strimwidth() accepts five different parameters to trim the string width.$str_string − The string that is to be decoded.$int_start − This integer parameter will trim the string from the specified start position. It will trim the string of characters from the beginning of the string.$int_width − The width of the desired trim. Negative widths count from the ... Read More

Advertisements