1.2.61. Autoappend¶
Appending a variable to itself leads to exponential usage of memory. Each time, the size of the variable is doubled. It is recommended to avoid using so much memory.
<?php
// Always append a value to a distinct variable
foreach($a as $b) {
$c[] = $b;
}
// This copies the array to itself, and double the size each loop
foreach($a as $b) {
$c[] = $c;
}
?>
1.2.61.1. Connex PHP features¶
1.2.61.1.1. Suggestions¶
Change the variable on the left of the append
Change the variable on the right of the append
1.2.61.1.2. Specs¶
Short name |
Performances/Autoappend |
Rulesets |
|
Exakat since |
1.8.3 |
PHP Version |
All |
Severity |
Minor |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Available in |