Re: [PHP4BETA] suggestion for new function str_change(string
| From: | Christian Schneider | Date: | Sat, 20 Nov 1999 15:42:41 +0000 |
| Subject: | Re: [PHP4BETA] suggestion for new function str_change(string | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6585@lists.php.net to get a copy of this message | ||
Andi Gutmans wrote:
> Well I mean I wouldn't give different options. I'd either stick to the
> "first come win" rule or the "overwrite" rule.
I'd love to have an array version, i.e. create an array with all the collisions.
This gives you the number, the first come win and the overwrite in one go. Is
not as efficient as having the three separate versions but e.g. for creating an
inverted index it's very handy. Depending on the implementation it shouldn't be
that much slower to add to an array than to overwrite, no?
Hmm... there's even a yet more evil situation:
$a['foo'] = array(42, 64);
$a['bar'] = array(17, 42);
=>
$a[17] = 'bar'; (or array('bar')? Hmm....)
$a[42] = array('foo', 'bar');
$a[64] = 'foo';
I think I've done too much work with full text retrieval where you need exactly
this inversion :-)
Cheers,
- Chris
--
Chris Schneider, mailto:cschneid@relog.ch
Computers are not intelligent. They only think they are.