myFunction("name", "age", "IsStudent");
$lastName = "Hugo";
$concatenatedString = "$lastName is a student";
PHP allows declaring a string with simple or double quotes. Using double quotes allows developers to insert variables which will be substituted during execution. When the string has no variables, using single quotes prevents PHP from searching for non-existent variables. It will save CPU cycles consumption and RAM usage.
myFunction("name", "age", "IsStudent");
$lastName = "Hugo";
$concatenatedString = "$lastName is a student";
myFunction('name', 'age', 'IsStudent');
$lastName = 'Hugo';
$concatenatedString = $lastName . 'is a student';
Energy: measured in joules (J)
Transfer: measured in Bytes (B)
Storage: measured in Bytes (B)
The control of these 3 impacts allows to lengthen the life of the terminals as well as reduce their energy consumption.
The ETSdiff tool allows measuring a differential on these three values and in a given context (database and fixed measurement environment).
The results generated by ETSdiff must help define the interest of the rule reported by SonarQube in the context of the code analyzed.
| Source of impacts | Compliant | Non-compliant |
|---|---|---|
Energy (J) |
3.041966 |
1.2651545000000002 |
Transfer (B) |
68520884 |
68588123 |
Storage (B) |
637548795 |
637548795 |