Re: [PHP4BETA] suggestion for new function str_change(string
| From: | Rasmus Lerdorf | Date: | Thu, 01 Jan 1970 00:00:00 +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-6590@lists.php.net to get a copy of this message | ||
> At 09:37 AM 11/20/99 -0500, Rasmus Lerdorf wrote:
> > str,array transtable [,bool reverse])
> >In-Reply-To: <4.2.0.58.19991120163254.00b2f2e0@mail.zend.com>
> >Message-ID: <Pine.WNT.4.21.9911200935490.-929693@lithium.jetpen.com>
> >X-X-Sender: rasmus@imap3.bellglobal.com
> >MIME-Version: 1.0
> >Content-Type: TEXT/PLAIN; charset=US-ASCII
> >
> > > By the way, I wouldn't have a rule for collisions. You'll just make things
> > > complicated and it won't be very useful in any case.
> >
> >What do you mean no rule? You have to do something in order to determine
> >which value to put in the flipped element slot.
>
> Well I mean I wouldn't give different options. I'd either stick to the
> "first come win" rule or the "overwrite" rule.
> Having three different options would just make the function obscure and I
> personally can't think how they would be used. It's very hard to make any
> rules about such things.
Well, I was just going by what I have written array flipping functions to
do in the past. Most of the time when I flip an array it is because I am
doing some sort of bucket algorithm where I want to count the number of
items in each bucket. Figured it would be cool if this function could do
that too. But you are right, it migt be too much overloading for one
function. It could get a separate name and behind the scenes it could use
the same code with an interna flag.
-Rasmus