Re: [PHP4BETA] suggestion for new function str_change(string
| From: | Andrei Zmievski | Date: | Sat, 20 Nov 1999 19:24:26 +0000 |
| Subject: | Re: [PHP4BETA] suggestion for new function str_change(string | ||
| References: | 1 2 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-6595@lists.php.net to get a copy of this message | ||
On Sat, 20 Nov 1999, Christian Schneider wrote:
> 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 :-)
I propose to call this function array_transpose() instead of
array_flip().
-Andrei
* Anything will fit if you push hard enough *