Php.net 有这个 preg_replace 片段
$string = 'The quick brown fox jumped over the lazy dog.';
$patterns = array();
$patterns[0] = '/quick/';
$patterns[1] = '/brown/';
$patterns[2] = '/fox/';
$replacements = array();
$replacements[2] = 'bear';
$replacements[1] = 'black';
$replacements[0] = 'slow';
echo preg_replace($patterns, $replacements, $string);
有没有办法在 $patterns 上运行 preg_match 来做这样的事情
如果在 $string 中找到 preg_match 则 preg_replace 否则回显未找到匹配项
谢谢。