Re: [PHP4BETA] suggestion for new function str_change(string

From: Date: Sat, 20 Nov 1999 16:53:35 +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-6588@lists.php.net to get a copy of this message
At 04:42 PM 11/20/99 +0100, Christian Schneider wrote:
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 :-)
I still don't understand what you wish to gain from the array version. We are talking about a string substitution function here, and the actual "work" is done internally. What kind of substitution do you expect to happen if there are collisions? You can't expect it to put all of the possible values so how is saving all of the collisions in an array helpful? In any case I don't really mind what happens with this if everyone's happy, I just want you guys to think of what will really be used on a day to day basis. Andi --- Andi Gutmans <andi@zend.com> http://www.zend.com/

« previous php.version4 (#6588) next »