Hi Group,
At the moment I am developing a app that uses templates.
In the templates I have placeholders like this:
Dear ***FIRSTNAME*** <br>
You have subscribed to ***LISTSUBSRIBE ***.
etc
The ***XXXX*** must be replaced with values created in my script.
I am a bit worried about the speed and wonder which approach will be
fastest.
A straightforward solution would be to run a
str_replace($ar rSearch,$arrRep lace), where
$arrSearch contains the strings to be replaced by the corresponding values
in $arrReplace.
Is this a fast solution?
Will a regexpression approach be faster?
Does anybody have experience with this or advise?
Or should I just try a few and benchmark it?
TIA!
Regards,
Erwin Moller
At the moment I am developing a app that uses templates.
In the templates I have placeholders like this:
Dear ***FIRSTNAME*** <br>
You have subscribed to ***LISTSUBSRIBE ***.
etc
The ***XXXX*** must be replaced with values created in my script.
I am a bit worried about the speed and wonder which approach will be
fastest.
A straightforward solution would be to run a
str_replace($ar rSearch,$arrRep lace), where
$arrSearch contains the strings to be replaced by the corresponding values
in $arrReplace.
Is this a fast solution?
Will a regexpression approach be faster?
Does anybody have experience with this or advise?
Or should I just try a few and benchmark it?
TIA!
Regards,
Erwin Moller
Comment