Example 1 — Step Back One Letter
Each call moves the string one step backward.
<?php
echo str_decrement("c"), PHP_EOL;
echo str_decrement("Az"), PHP_EOL; How It Works
- Pass a letter.
cis the third letter. - Get the previous one. The result is
b. - Case is kept.
AzbecomesAy. - Only the last letter changes. Unless a carry is needed.

