str_increment
str_increment
Increment an alphanumeric string
string **str_increment** string $string
Returns the incremented alphanumeric
.
string
stringThe input string.
Returns the incremented alphanumeric string.
A is thrown if
is empty.
ValueError``string
A is thrown if
is not an alphanumeric
string.
ValueError``string
Voorbeeld: Basic example
<?php
$str = 'ABC';
var_dump(str_increment($str));
?>
string(3) "ABD"
Voorbeeld: example with a carry
<?php
$str = 'DZ';
var_dump(str_increment($str));
$str = 'ZZ';
var_dump(str_increment($str));
?>
string(2) "EA"
string(3) "AAA"
str_decrement