This question already has an answer here:
I would like to know how to split number and character into string in PHP. for example. I have string B234CR45SV42
and I wan to split into
B
234
C
R
45
SV
42
Please note that my code will change different character and numbers any time.
</div>
Use regex in preg_match_all()
function to select target parts of string.
$str = "B234CR45SV42";
preg_match_all("/[A-Z]+|\d+/", $str, $matches);
print_r($matches[0]);
See result in demo