1.2.1036. Repeated print()¶
Merge several print or echo in one call, to speed up the processing.
It is recommended to use echo with multiple arguments, or a concatenation with print, instead of multiple calls to print echo, when outputting several blob of text.
<?php
//Write :
echo 'a', $b, 'c';
print 'a' . $b . 'c';
//Don't write :
print 'a';
print $b;
print 'c';
?>
1.2.1036.1. Suggestions¶
Merge all prints into one echo call, separating arguments by commas.
Collect all values in one variable, and do only one call to print or echo.
1.2.1036.2. Specs¶
Short name |
Structures/RepeatedPrint |
Rulesets |
All, Analyze, CE, CI-checks, Changed Behavior, Suggestions, Top10 |
Exakat since |
0.8.4 |
PHP Version |
All |
Severity |
Major |
Time To Fix |
Quick (30 mins) |
Precision |
Very high |
Features |
|
ClearPHP |
|
Examples |
|
Available in |