Re: Re: [RFC] [VOTE] Random Extension 5.x
| From: | Tim Düsterhus | Date: | Fri, 17 Jun 2022 18:13:08 +0000 |
| Subject: | Re: Re: [RFC] [VOTE] Random Extension 5.x | ||
| References: | 1 2 3 4 5 6 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-117991@lists.php.net to get a copy of this message | ||
Hi
On 6/17/22 19:46, Go Kudo wrote:
I was fundamentally wrong, I understand now. As you said, there was no interoperability withYes, I agree here. But I believe that "generate a string with a given alphabet" is a very common operation that would be useful to include in the standard library. In any case it's better to leave something out than to implement something badly, so if you don't feel comfortable with that, then leave it out. There will be more PHP versions after 8.2. For me both of these: ->randomString(string $alphabet, int $length) ->stringFromAlphabet(string $alphabet, int $length) with the description "Return a string of $length characters selected from the given $alphabet. Characters may be selected more than once". would be acceptable names. Best regards Tim DüsterhuspickArrayKey()in the first place...stringFromAlphabet()Hmmm. I guess randomString would be better then. At the same time, it would be nice to have an array version of randomArray. However, I don't want to add more methods without any thought. I think operations that can be done on userland should be done on userland. That is why I did not implement the array_rand() function in the first place.