1.2.1166. Strict In_Array() Preference¶
It is possible to set in_array() to strict search mode, by using the third argument.
The analyzed code has less than 10% of one of the two sets : for consistency reasons, it is recommended to make them all the same.
Warning : the two sets of operators have different precedence levels. Using and or && is not exactly the same, especially and not only, when assigning the results to a variable. In doubt, it is recommended to use the strict mode.
<?php
// relax mode : value may use typejuggling with the array values
in_array($value, $array );
// strict mode : value is compared to array's value with both data and type
in_array($value, $array, true);
?>
1.2.1166.1. Connex PHP features¶
1.2.1166.1.1. Specs¶
Short name |
Structures/StrictInArrayFavorite |
Rulesets |
|
Exakat since |
2.4.7 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |