I’m working on something where the user is generating a number of objects in a form. When they submit the form, I want to echo the results back to them in a list (very distilled summary of what I’m doing).
In PHP, I know how to increment something in the conventional manner (1, 2, 3), but due to elements in the UI, I want to increment the list alphabetically (A, B, C). How would I do this?
Working code incrementing the list numerically:
//LOOP THROUGH THE ARRAY OF OBJECTS PASSED TO THIS PAGE FROM THE FORM
foreach ($waypoints as $key => $value) {
$current = $key + 1;
echo "<p><strong>Waypoint #$current:</strong> $value</p>";
}
You can increment letters in the same way: