I am trying to print out a series of strings in a loop, modifying the string each iteration. Specifically, I want to add a letter into the string and with each iteration sequentially increment the letter through the alphabet.
For example if I run the foreach function below:
foreach ( $terms as $term ) {
echo "data-tax='".$term->name."'";
}
I would get something like
data-tax='apple'
data-tax='orange'
data-tax='banana'
However I want to add a letter into the string which increments each run yielding the following:
data-tax-a='apple'
data-tax-b='orange'
data-tax-c='banana'
How can I achieve this? I know I can add a letter into the string, but how can I move it through the alphabet?