[Fwd: Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()]
| From: | Sara Golemon | Date: | Wed, 29 Jan 2003 22:41:08 +0000 |
| Subject: | [Fwd: Re: [PHP-DEV] Feature Request #5919 case-insensitive version of str_replace()] | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-93779@lists.php.net to get a copy of this message | ||
whoops, missent just to sascha instead of list...
>> On a related topic, the 'boyer' option of str_replace isn't even
>> documented. That alternate method of performing str_replaces look
>> like it's a bit more efficient (no benchmarkes atm) but I'm wondering
>> if there's a specific reasons why it wasn't documented yet.
>
> The BM algorithm is outdated and can savely be dropped.
>
> - Sascha
>
That simplifies implementation then :) Here's a patch that takes out
the boyer implementation and cleans up the parameter accepting in both
str_replace and str_ireplace. It also avoids the _ex business since
replace_in_subject is a static method which is only called by
str_replace str_ireplace anyway. I also reduced php_str_to_str back to
a single implementation by passing the case_sensitivity parameter to it,
but since it's a PHPAPI function I also renamed it *_ex and created a
passthrough for BC.
http://169.229.139.97/test/str_ireplace.diff-3.txt
The "large chunk of added code" is getting diminishingly smaller...
though I suppose str_replace and str_ireplace could be turned into
passthrough wrappers for a unified version, but that's probably going
further than necessary.
-Pollita