print_r(splitCode("TEWA8392")); // ➞ ["TEWA", 8392]
print_r(splitCode("MMU778")); // ➞ ["MMU", 778]
print_r(splitCode("SRPE5532")); // ➞ ["SRPE", 5532]


function splitCode($code) {
	$alpha = $numbers = '';
	$len = strlen($code);
	for ($i=0; $i<$len; $i++) {
		if(!(47 < ord($code[$i])&&ord($code[$i]) < 58)) {
		// if(!is_numeric($code[$i])) {
			$alpha.=$code[$i];
		} else {
			$numbers = substr($code, $i);
			break;
		}
	}
	return [$alpha, $numbers];
}
by ვაჟა ტყემალაძე
2 years ago
PHP
Problem Solving
0
Pro tip: use ```triple backticks around text``` to write in code fences