Is there any built-in PHP function through which I can count the sum of indexes of letters of the alphabet found in a string?
<?php
$a = "testword";
echo "Count of Characters is: " . strlen($a);
?>
Now I want to get a cumulative “total” of this word.
e.g.
Ais the first letter of the alphabet so it maps to1Bis the second letter of the alphabet so it maps to2Cis the third letter of the alphabet so it maps to3Dis the fourth letter of the alphabet so it maps to4
So the word ABCD gives 1+2+3+4=10
Similarly I need a function for “testword” or any word.
1 Answer