str_increment()

str_increment() — Increment an alphanumeric string.

Built-in function of PHP 8.5. The manual lists it as available in PHP 8 >= 8.3.0. This page is the reference card: signature, parameters and return value, plus the changelog and the example the manual provides.

Signature

str_increment(string $string): string

Parameters

ParameterTypeWhat it takes
$stringstringThe input string.

Return value

Returns the incremented alphanumeric ASCII string.

Example

A runnable snippet:

$str = 'ABC'; var_dump(str_increment($str));

Output:

string(3) "ABD"

See also

str_decrement()

All PHP 8.5 built-in functions

Reference card built from the PHP manual page str_increment() (PHP documentation, CC BY 3.0). The page is generated from the manual, so the wording of the parameter and return value text follows php.net.