mb_str_split
Given a multibyte string, return its character array
Function name: mb_str_split()
Applicable version: PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8
Usage: mb_str_split(string $string, int $length = 1, string $encoding = null): array|false
Description: The mb_str_split() function splits a string into a single character and returns an array containing the split characters. This function is multibyte-safe and can handle various character encodings.
parameter:
Return value:
Example:
$str = "Hello PHP"; $result = mb_str_split($str); print_r($result);
Output:
Array ( [0] => H [1] => e [2] => l [3] => l [4] => o [5] => [6] => P [7] => H [8] => P )
In the above example, we use the mb_str_split() function to split the string "Hello PHP" into a single character and store the result in the array $result. Finally, use the print_r() function to print the output result.