I have for example string $s = 'A5C7';
and $s = 'A5C17';
I was try split string by symbols using preg_split('//', $s, -1, PREG_SPLIT_NO_EMPTY);
If string $s = 'A5C7'
I got OK result like this:
array(4) {
[0]=>
string(1) "A"
[1]=>
string(1) "5"
[2]=>
string(1) "C"
[3]=>
string(1) "7"
}
but if use $s = 'A5C17'
I got:
array(5) {
[0]=>
string(1) "A"
[1]=>
string(1) "5"
[2]=>
string(1) "C"
[3]=>
string(1) "1"
[4]=>
string(1) "7"
}
I wanna got like this:
array(4) {
[0]=>
string(1) "A"
[1]=>
string(1) "5"
[2]=>
string(1) "C"
[3]=>
string(1) "17"
}
How to improve preg_split('//', $s, -1, PREG_SPLIT_NO_EMPTY);
for getting both type of results?
Thanks in advance.