Increment Non-alphanumeric

PHP has a string increment feature, where a string may be incremented by one, to its next ASCII character.

This does not apply to non-alphanumeric characters, such as space, semi-colon, etc. Until PHP 8.4, it was silent, and now, it is a warning.

PHP code

<?php

$a = ';';
++$a;

echo $a;

?>

Before

PHP Deprecated:  Increment on non-alphanumeric string is deprecated

Deprecated: Increment on non-alphanumeric string is deprecated
;

After

PHP Deprecated:  Increment on non-numeric string is deprecated, use str_increment() instead

Deprecated: Increment on non-numeric string is deprecated, use str_increment() instead

PHP version change

This behavior changed in 8.5

Error Messages