1.2.984. Plus Plus Used On Strings¶
This rule reports strings that are incremented with the post increment operator 's'++
.
This spots issues of the famous feature of PHP : incrementing strings with letters.
This analysis checks for string to be incremented. It doesn’t check if the string is a numeric string, but does check the type, implicit or explicit.
<?php
$a = 'a';
$a++;
print $a;
// prints b
?>
See also Incrementing/Decrementing Operators and Path to Saner Increment/Decrement operators.
1.2.984.1. Connex PHP features¶
1.2.984.1.1. Specs¶
Short name |
Php/PlusPlusOnLetters |
Rulesets |
|
Exakat since |
2.5.1 |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
High |
Available in |