I am trying to split a string into 1, 2 and 3 segments.
For example, i currently have this:
$str = 'test';
$arr1 = str_split($str);
foreach($arr1 as $ar1) {
echo strtolower($ar1).' ';
}
Which works well on 1 character splitting, I get:
t e s t
However when I try:
$arr2 = str_split($str, 2);
I get:
te st
Is there a way so that I can output this? :
te es st
and then also with 3 characters like this?
tes est