How to split this string 'هذا مثال' into seperate characters without whitespace using preg_split or mb_split?
I'm trying to split with preg_split('//u', $str, NULL, PREG_SPLIT_NO_EMPTY)
but not to remove whitespace.
I want the following result: (remove space without using preg_replace or str_replace)
Array
(
[0] => ه
[1] => ذ
[2] => ا
[3] => م
[4] => ث
[5] => ا
[6] => ل
)
$chars = preg_split('/[\.\s]?/u', $str, NULL, PREG_SPLIT_NO_EMPTY);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.