Monty,

> Is preg_replace() the best PHP command to use for parsing custom codes
in
> 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!

RTFM http://www.php.net/manual/en/function.str-replace.php:
-----
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
array.
-----

Regards,
=dn


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to