<?php
$start = microtime(true);
for ($i=0; $i<1e4; $i++) {
$string = sprintf("%s%s$%s%s", $i, $i, '123', 'Test');
}
$end = microtime(true);
echo "Took: ", number_format(($end-$start)*1e3, 2), 'ms', PHP_EOL;
$a = '123';
$b = 'Test';
$start = microtime(true);
for ($i=0; $i<1e4; $i++) {
$string = "$i$i$123$a$b";
}
$end = microtime(true);
echo "Took: ", number_format(($end-$start)*1e3, 2), 'ms', PHP_EOL;
preferences:
43.91 ms | 402 KiB | 5 Q