Re: [PHP4BETA] suggestion for new function str_change(string
| From: | Thies C. Arntzen | Date: | Sat, 20 Nov 1999 18:46:14 +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-6591@lists.php.net to get a copy of this message | ||
On Sat, 20 Nov 1999, Rasmus Lerdorf wrote:
> > 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
i have added array_count_values() some time ago - use that for that;-)
i'll implement array_flip(). for the sake of simplicity the last value (in
this case the last key) will win. we can easily improve that later - but
right now my goal is to have a nice forward<->backward string-translator
using the "new" strtr() stuff.
tc
>
>
> --
> PHP 4.0 Beta Mailing List <http://www.php.net/version4/>
> To unsubscribe, e-mail: php4beta-unsubscribe@lists.php.net
> For additional commands, e-mail: php4beta-help@lists.php.net
> To contact the list administrators, e-mail: php4beta-admin@lists.php.net
>
>
Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!"
Digital Collections Phone +49 40 235350 Fax +49 40 23535180
Hammerbrookstr. 93 20097 Hamburg / Germany