regex - PHP, what is the better choice for removing a known string? -


I'm looking for another string to search and replace a known string. Should I use str_replace () or preg_replace ()? The string to be replaced will be the same as [+ qStr +] , [+ bqID +] , or [+ AID +] Searching for a code in Chuck:

  & lt; Li & gt; [QStr +] & lt; Ol class = "mclfa" & gt; & Lt; Li & gt; Input = "radio" name = "[+ bqID +]" id = "[+ bqID +] _ [+ AID +]" value = "[+ AID +]" /> & Lt; Label = "[+ bqID +] _ [+ help +]" & gt; [+ Astr +] & lt; / Labels & gt; & Lt; / Li & gt; & Lt; / Ol & gt; & Lt; / Li & gt;  

I would like to change the strings with a result from a MySQL query, and at 200 times this verb. Which function would be the fastest way to take str_replace () or preg_replace () the easiest and / or faster way.

If your string is fixed, and you do not need regular expressions, always str_replace Use it because it will be faster, note that you should forget about ereg_replace, and always use preg_replace, as the former has been excluded.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -