I am looking to find and replace a known string from another string. Should I use str_replace () or preg_replace ()? The string that needs to be replaced will look like [+qStr+], [+bqID+]or [+aID+], and it will be searched for in a piece of code like 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 replace the rows with the results of a MySQL query and perform this action or the like up to 200 times at a time. Which function str_replace () or preg_replace () will be the easiest and / or fastest way.
source
share