You are here: [Speed] Multiple scans through variable for search/replace « PHP Programming Language « IT news, forums, messages
[Speed] Multiple scans through variable for search/replace

Posted by Erwin Moller on 11/17/06 12:22

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($arrSearch,$arrReplace), 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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация