String Increment

String increment is the PHP feature that applies the ++ pre- and post-increment operators on non-numeric strings.

These strings last character’s ASCII code is incremented by one, with possible extension of the string when the letters reach z and Z.

This feature is deprecated, and shall be removed in PHP 9. It has been moved to the str_increment() function, which has the same feature, though not implicit in the engine anymore.

<?php

$s = 'y';
echo ++$s; // z
echo ++$s; // aa
echo ++$s; // ab

$s = 'Y';
echo ++$s; // Z
echo ++$s; // AA
echo ++$s; // AA

?>