Answer the question
In order to leave comments, you need to log in
How to split a string into characters using preg_split without spaces?
I'm trying to split the string into characters and put it into an array using preg_split, but spaces are added along with all the characters.
$text = 'plain text';
$text_trim = trim($text);
$str = preg_split('//u',$text_trim,-1,PREG_SPLIT_NO_EMPTY);
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question