> Is preg_replace() the best PHP command to use for parsing custom codes
> text retrieved from a database (e.g., turning "[link= ]" into "<a
href= >")?

It is conventional wisdom that the PCRE functions are faster than their
EREG cousins.

However because/if you can guarantee that your 'template' links are in a
particular case then string functions (str_replace) are fastest if all.
Best of all, it is easy to perform multiple replaces (of the same
substrings) on multiple replace-pairs. NB case sensitivity!

This function returns a string or an array with all occurences of search
in subject replaced with the given replace value. If you don't need
fancy replacing rules, you should always use this function instead of
ereg_replace() or preg_replace().

In PHP 4.0.5 and later, every parameter to str_replace() can be an


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to