PHP mb_strpos() Function Last Updated : 29 Mar, 2023 Comments Improve Suggest changes Like Article Like Report The mb_strpos() function is an inbuilt function in PHP that finds the position of string occurrence in the string. Syntax: mb_strpos( $haystack, $needle, $offset, $encoding ): int|falseParameters: This function accepts 4 parameters that are described below: $haystack: This parameter is the main string parameter where we check the string.$needle: This parameter is searching string parameter in the main string.$offset: This parameter is an optional parameter. It is used for defining where you are to start searching string in the $haystack parameter.$encoding: This parameter is also optional. It is used for defining an encoding by using the mb_internal_encoding() function.Return Values: This function returns return the integer of the first occurrence of $needle in the $haystack parameter. If $needle does not find in the $haystack parameter, it will return "false". Example 1: The following code demonstrates the mb_strpos() function. PHP <?php $string = "This is a test string"; $substring = "test"; $position = mb_strpos($string, $substring); // Output the position echo $position; ?> Output: 10 Example 2: The following code demonstrates the mb_strpos() function. PHP <?php $string = "GeeksforGeeks"; $substring = "test"; if (mb_strpos($string, $substring)) { echo "Substring is found"; } else { echo "Substring is not found"; } ?> Output: Substring is not found Reference: https://www.php.net/manual/en/function.mb-strpos.php Comment More infoAdvertise with us Next Article PHP mb_strpos() Function N neeraj3304 Follow Improve Article Tags : PHP PHP-function PHP-Multibyte-String Similar Reads PHP mb_stripos() Function The mb_stripos() function is an inbuilt case-insensitive function that finds the first occurrence of a substring in the string. Syntax: int|false mb_stripos( string $haystack, string $needle, int $offset , ?string $encoding);Parameters: This function accepts 4 parameters that are described below. $h 2 min read PHP mb_strripos() Function The mb_strripos() function is a PHP inbuilt case-insensitive function that is utilized to find the position for the last occurrence of a string inside another string. Syntax: mb_strripos($haystack, $needle, $offset = 0,encoding = null): int|falseParameters: This function accepts four parameters desc 2 min read PHP mb_strstr() Function The mb_strstr() function is an inbuilt function in PHP that finds the first occurrence of a given string in the main string, i.e. it will search for the occurrence of the first needle in haystack, & id found then the portion of the haystack will be returned, otherwise return false. Syntax: mb_st 2 min read PHP mb_stristr() Function The mb_stristr() is an inbuilt function in PHP that is used to get the first occurrence of a string within another string. It will check case insensitivity. Syntax:mb_stristr( $haystack, $needle, $before_needle, $encoding = null ): string|falseParameters: This function accepts 4 parameters that are 2 min read PHP mb_strlen() Function The mb_strlen() is an inbuilt PHP function that returns the string length in an integer. Syntax: mb_strlen($string, $encoding ): intParameters: This function accepts 2 parameters that are described below: $string: The string parameter whose lengths need to be determined. It is a required parameter.$ 1 min read Like