1.2.399. Echo With Concat

Optimize your echo’s by avoiding concatenating at echo time, but serving all argument separated. This will save PHP a memory copy.

If values, literals and variables, are small enough, this won’t have visible impact. Otherwise, this is less work and less memory waste. instead of It is a micro-optimisation.

<?php
  echo $a, ' b ', $c;
?>

1.2.399.1. Suggestions

  • Turn the concatenation into a list of argument, by replacing the dots by commas.

1.2.399.2. Specs

Short name

Structures/EchoWithConcat

Rulesets

All, Analyze, Performances, Suggestions

Exakat since

0.8.4

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

Very high

Features

echo

ClearPHP

no-unnecessary-string-concatenation

Examples

Phpdocumentor, TeamPass

Available in

Entreprise Edition, Exakat Cloud