in reply to How the auto-increment operator works?
For the same reason that the following results in 100 instead of 00 (0).
$x = 99; ++$x;
If you exceed the range of the second position, it carries into the third position. To keep it to two digits, you need to take explicit action.
$x = 99; ++$x; $x %= 100;
$x = 'zz'; ++$x; $x = substr($x, -2);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How the auto-increment operator works?
by zapdos (Sexton) on Aug 01, 2020 at 00:44 UTC |