Как мне лучше всего добиться следующего:
Я бы хотел найти и заменить значения в строке в PHP, если они не заключены в одинарные или двойные кавычки.
EG.
$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
строка должна возвращать:
'The replaced words I would like to replace unless they are "part of a quoted string" '
Заранее спасибо за помощь.