1.2.854. Non Integer Nor String As Index¶
Report usage of non-integer and non-string types as index in an array syntax.
PHP arrays only accept integers and strings as keys. PHP convert the other types to integer or string, and that may lead to surprises when reading the arrays.
<?php
function foo (float $index, array $array) {
$array[$index];
}
?>
1.2.854.1. Specs¶
Short name |
Structures/NonIntStringAsIndex |
Rulesets |
|
Exakat since |
2.6.2 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Low |
Available in |