str_replace() 与关联数组
2022-08-30 13:47:21
您可以将数组与 str_replace() 一起使用:
$array_from = array ('from1', 'from2');
$array_to = array ('to1', 'to2');
$text = str_replace ($array_from, $array_to, $text);
但是,如果您有关联数组呢?
$array_from_to = array (
'from1' => 'to1';
'from2' => 'to2';
);
如何将其与 str_replace() 一起使用?
速度很重要 - 阵列足够大。