Re: str_replace vs. preg_replace speed
| From: | David T-G | Date: | Wed, 17 Dec 2003 06:01:29 +0000 |
| Subject: | Re: str_replace vs. preg_replace speed | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-172856@lists.php.net to get a copy of this message | ||
Shawn, et al --
..and then Shawn McKenzie said...
%
% I will run some benchmarks (even though they may be flaky), but what would
% be the fastest execution?
..
%
% Or, if I created one expression that handled all of the five $search items
% (since they are similar) and used preg_replace()?
The manual says
Tip: preg_replace(), which uses a Perl-compatible regular
expression syntax, is often a faster alternative to ereg_replace().
but nothing about str_replace. Are you curious, going for absolutely
best performance, or just being efficient? If the latter, I'd lean more
toward writing your code the same way all of the time for uniformity and
simplicity.
%
% Thanks!
% -Shawn
HTH & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!