I am looking to search for and replace a known string from within another string. Should I use str_replace() or preg_replace()? The string to be replaced would be something similar to [+qStr+]
, [+bqID+]
, or [+aID+]
and it would be being searched for in a code chunk similar to this:
<li> [+qStr+]
<ol class="mcAlpha">
<li><input type="radio" name="[+bqID+]" id="[+bqID+]_[+aID+]" value="[+aID+]" /><label for="[+bqID+]_[+aID+]">[+aStr+]</label></li>
</ol>
</li>
I would be replacing the strings with the results from a MySQL query, and be performing this action or similar up to 200 times at a time. Which function str_replace() or preg_replace() would be the easiest and/or quickest method to take.