| This article introduces an example of using php to quickly split Chinese strings into arrays for your reference. In php, it is very easy to split strings, mainly using the preg_match_all function. When processing a string containing Chinese characters, you can use the following method:
Output result: array ([0] => h [1] => I [2] => fishing [3] => fish [4] => Island [5] => Yes [6] => China [7] => country [8] =>) Note: The pattern modifier u is fully supported in php5. Example 2: use PHP to separate Chinese Strings Split the string "love lotus" into "love", "Lotus", and "Say. Use the php function preg_match_all. Example:
Output result: array 0 => array 0 => string 'ay' (length = 3) 1 => string 'loan' (length = 3) 2 => string ''(length = 3). you can obtain a specific word through an array. For more information about how to use php to separate Chinese and English strings, see: php to separate Chinese and English strings. |