ok I have read quite awhile on preg_replace. But I am still not understanding it very well. This is the example I found:
<?php
$string = 'The quick brown fox jumped over the lazy dog.';
$patterns[0] = '/quick/';
$patterns[1] = '/brown/';
$patterns[2] = '/fox/';
$replacements[2] = 'bear';
$replacements[1] = 'black';
$replacements[0] = 'slow';
echo preg_replace($patterns, $replacements, $string);
?>
makes it like this:
The bear black slow jumped over the lazy dog.
and this code:
<?php
ksort($patterns);
ksort($replacements);
echo preg_replace($patterns, $replacements, $string);
?>
to ouput it in order:
The slow black bear jumped over the lazy dog.
Why such the hassle? why can't I just make the dang thing have a <strong></strong> tag around the word? See I have a Query and in each listing for details (there will be ten rows of $details results) well in each $details result I want to replace 'Erie' 'erie bars' 'bars' 'clubs' and other relevent text or keywords inside of strong tags. I really don't understand this preg_replace thing yet.