note 43006 added to function.str-ireplace
| From: | kireatgamedesigndotbe at rn2 dot php dot net | Date: | Sun, 06 Jun 2004 19:21:44 +0000 |
| Subject: | note 43006 added to function.str-ireplace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-70679@lists.php.net to get a copy of this message | ||
After some tests i noticed that str_ireplace isn't always faster as preg_replace with the
i-modifier.
str_ireplace when the needle appears in the result in lower letters (so "test" will be
replaced faster as "TEST"). Doing the same test with a string which contained only capital
letters was almost 7-8x slower then a string which contained only lowercase letters. preg_replace
however didn't have any problems with capital letters and kept the same speed.
Also the length of needle seemed to have an influence on the speed of str_ireplace, but this
difference isn't that spectacular, but again it seems to be slower when the needle is longer.
However this tests were done with PHP5 RC2 (on IIS) and str_ireplace probably wasn't fully
optimized, str_ireplace was only faster on a string with lowercase letters AND with a short needle.
----
Manual Page -- http://www.php.net/manual/en/function.str-ireplace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43006
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43006&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43006&report=yes
Search -- http://master.php.net/manage/user-notes.php