PHP mb_str_split() Function Last Updated : 19 Oct, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report The mb_str_split() function was introduced in the release of PHP version 7.4.0 and it is only supported with PHP versions equal to or greater than 7.4.0. The mb_str_split() function serves as an alternate of str_split() function. It is used to split the given string with the specified length of chunks and returns an array on success and FALSE on failure but in PHP 8, it does not return FALSE on failure . Syntax: array mb_str_split(string $string, int $length, string $encoding) Parameters: Name Type Description $stringstringThe string which is to be splitted into chunks and it is required.$lengthintLength of the substring in which the string is being split. It is optional parameter.$encodingstringEncoding format which is to be applied on the substring. It is an optional parameter and default value is null. Example 1: In the below example, the word "Awesome" is being split by using mb_str_split() function and since this function returns an array of characters print_r() has been used to print the output. PHP <?php print_r(mb_str_split("Awesome")); ?> Output: Array ( [0] => A [1] => w [2] => e [3] => s [4] => o [5] => m [6] => e ) Example 2: In the below example, two variables $sentence and $word has been created. The $sentance is used to store any random sentence of string type whereas $word is used to store the array returned by mb_str_split(). The basic idea of the code is to separate "GeeksforGeeks" from the sentence which is stored in $sentence. Here, mb_str_split() is used to separate the substring with the specified length and the array is stored in $word and the result is displayed accordingly. PHP <?php $sentence = "GeeksforGeeks is Awesome"; $word = mb_str_split($sentence,13); echo $word[0]; ?> Output: GeeksforGeeks Reference: https://www.php.net/manual/en/function.mb-str-split.php Comment More infoAdvertise with us Next Article PHP mb_stristr() Function T talktoosaurabh Follow Improve Article Tags : Web Technologies PHP PHP-string PHP-function Similar Reads PHP mb_split() Function The mb_split() is an inbuilt PHP function that split the multibyte strings with help of the regular expression. Syntax: mb_split(pattern,string,limit): array|falseParameters: Â This function accepts 3 parameters: pattern: In this parameter, we define a regular expression that helps us to split a stri 1 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 strstr() Function The strstr() function is a built-in function in PHP. It searches for the first occurrence of a string inside another string and displays the portion of the latter starting from the first occurrence of the former in the latter (before if specified). This function is case-sensitive. Syntax : strstr( $ 2 min read PHP mb_strpos() Function 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 stri 2 min read PHP stristr() Function The stristr() function is a built-in function in PHP. It searches for the first occurrence of a string inside another string and displays the portion of the latter starting from the first occurrence of the former in the latter (before if specified). This function is case-insensitive. Syntax : strist 2 min read Like