Answer the question
In order to leave comments, you need to log in
PHP bench mark. Concatenation vs array collection + implode. What's faster?
on different computers different results
who can say which is faster?
or who is not too lazy, test, tell me how you aretime php <file> > /dev/null
<?php
$out = '';
for ( $i = 0; $i < 1000000; $i++ ) {
$out .= $i . '_' . $i;
}
echo $out;
?>
<?php
$out = [];
for ( $i = 0; $i < 1000000; $i++ ) {
$out[] = sprintf('%s_%s', $i, $i);
}
echo implode('', $out);
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question