PHP String Split Problem -
i'm having trouble figuring out how split string groups of characters. have few strings of rather random character groups similar one:
aaabb2222eee77777
i able split them so:
aaa, bb, 2222, eee, 77777
and able count number of characters in each set. easiest way this? i'm not sure start. thank you!
you can iterate through array , strlen()
of each item:
preg_match_all('/(.)\1*/', 'aaabb2222eee77777', $matches); $matches = $matches[0];
array ( [0] => aaa [1] => bb [2] => 2222 [3] => eee [4] => 77777 )
Comments
Post a Comment