次のことをどのように達成するのが最善でしょうか:
一重引用符または二重引用符で囲まれていない限り、PHP の文字列内の値を検索して置換したいと考えています。
例えば。
$string = 'The quoted words I would like to replace unless they are "part of a quoted string" ';
$terms = array(
'quoted' => 'replaced'
);
$find = array_keys($terms);
$replace = array_values($terms);
$content = str_replace($find, $replace, $string);
echo $string;
echo
'd 文字列は次を返す必要があります。
'The replaced words I would like to replace unless they are "part of a quoted string" '
よろしくお願いします。