Re: Feature Request #5919 case-insensitive version of str_replace()
| From: | Shane Caraveo | Date: | Wed, 29 Jan 2003 20:22:48 +0000 |
| Subject: | Re: Feature Request #5919 case-insensitive version of str_replace() | ||
| References: | 1 2 3 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93773@lists.php.net to get a copy of this message | ||
Derick Rethans wrote:
On Wed, 29 Jan 2003, Sara Golemon wrote:I may be wrong since I haven't profiled this, but my understanding is that str_replace is much faster than doing either of the regex replacements. For that reason alone, there is a use for it. ShaneI still don;t see no real use for this function, you can easily do this with eregi_replace() or preg_replace(). DerickI've got an implementation put together, the patch for which can be viewed at: http://169.229.139.97/test/str_ireplace.diff.txtAfter some comments on IRC, here's an alternate version to the above patch. This second approach avoids creating php_memnstri by simply searching through a copy of haystack which is strtolowered against a strtolowered version of needle (no need to copy that part). http://169.229.139.97/test/str_ireplace.diff-2.txt Should be quicker and cleaner at the cost of a small malloc in the estrndup call.