تخطَّ إلى المحتوى

String builder optimization (ARCH7071)

هذا المحتوى غير متوفر بلغتك بعد.

Key php.performance.string-builder-optimization · Severity info · Category performance

Chaining many parts with . in a single expression is hard to read and inefficient. Use a format string or implode() instead.

<?php
$line = $id . ' - ' . $name . ' (' . $age . ') ' . $city . ', ' . $country;
echo $line;
<?php
$line = sprintf('%d - %s (%d) %s, %s', $id, $name, $age, $city, $country);
echo $line;

Build multi-part strings with sprintf() or implode() in a single expression.