$arr = array(
"a" => "1"
"b" => "2"
"c" => "3"
"d" => "4"
"e" => "5"
"f" => "6"
);
$str = array(
"xxxxx{a}xxxxx{b}xxxx{f}xxxx",
"xxxxx{b}xxxxx{c}xxxx{d}xxxx",
"xxxxx{a}xxxxx{d}xxxx{e}xxxx",
);
the way I came up with is
foreach($str as $v)
{
foreach($arr as $ke=>$va)
{
$v = str_replace("{".$ke."}", $va, $v);
}
$newStr[] = $v;
}
return $newStr;
it doesn"t feel good to go through all the $arr every time.
can you guys give me some advice?