/////////////////////////////////////////////////////////////////
$time1= microtime();
$sCountry = "России";
$sBububu = "!";
$sName = "Вовка Путин";
$sText = "@sName@ - президент @sCountry@ @sBububu@";
preg_match_all('|@([^@]+)@|i', $sText, $arrMatches);
for ($iI;$iI<count($arrMatches[1]);$iI++) {
$sText = str_replace("@".$arrMatches[1][$iI]."@",$$arrMatches[1][$iI],$sText);
}
echo $sText.'<br> TIME1: '.(microtime()-$time1).'<br>';
/////////////////////////////////////////////////////////////////
$time1= microtime();
$replaces['sCountry'] = 'России';
$replaces['sBububu'] = '!';
$replaces['sName'] = 'Вовка Путин';
$sText = "@sName@ - президент @sCountry@ @sBububu@";
foreach ($replaces as $k=>$v)
$sText = str_replace('@'.$k.'@',$v,$sText);
echo $sText.'<br> TIME2: '.(microtime()-$time1).'<br>';
/////////////////////////////////////////////////////////////////