I suppose you could do it by defining an array where the keys are letters and the values are the numbers assigned to those letters, then loop through each character of the string and grab the numbers, etc. However, if you were to explain to us why you feel you need to do such a convoluted thing, we might be able to suggest a simpler and cleaner alternative. For instance, if the purpose is to generate a sort of single-digit checksum for the specified string, you could just do:
$checksum = substr(sprintf('%u', crc($string)), -1);