I have a string which is combination of letters and digits. For my application i have to separate a string with letters and digits: ex:If my string is \"12jan\" i hav to ge
This works for me as per my requirement, you can edit as per yours
function stringSeperator($string,$type_return){
$numbers =array();
$alpha = array();
$array = str_split($string);
for($x = 0; $x< count($array); $x++){
if(is_numeric($array[$x]))
array_push($numbers,$array[$x]);
else
array_push($alpha,$array[$x]);
}// end for
$alpha = implode($alpha);
$numbers = implode($numbers);
if($type_return == 'number')
return $numbers;
elseif($type_return == 'alpha')
return $alpha;
}// end function