How to Increment or Decrement String in PHP - str_increment() and str_decrement() Functions
The str_increment() function Increments an alphanumeric string and str_decrement() decrements an alphanumeric string.
Syntax
str_increment(string $string)
str_decrement(string $string)
Examples
Example 1: Basic Increment
echo str_increment('ABC');
Output: ABD
Example 2: Increment with Carry
echo str_increment('PZ');
Output: QA
Example 3: Decrement
echo str_increment('ABC');
Output: ABB