Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117991 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 65229 invoked from network); 17 Jun 2022 16:24:52 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2022 16:24:52 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 1236B180553 for ; Fri, 17 Jun 2022 11:13:11 -0700 (PDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS24940 176.9.0.0/16 X-Spam-Virus: No X-Envelope-From: Received: from chrono.xqk7.com (chrono.xqk7.com [176.9.45.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 17 Jun 2022 11:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bastelstu.be; s=mail20171119; t=1655489589; bh=/sm1U2kO6z8fdGWIgNwY7gBigLoxY85pWMZFQAX8kC4=; h=Date:Subject:To:References:From:In-Reply-To:From; b=TZALYLKUH/ql6b8YqHf4nDVxegHHUP6DlIya9crASg9kvutDh8VkSOC3xNMZAF+WV XnK0HhFf1iT/PJ3u7W4FY2xSQvfY1ngQG3FKtqRUirQvutLiiStpJKS7MJryR2fWla B3hc0PyU6t0/GoddG74Jlk67kInEgy4PJJfK9tL81wYyHq/ILdTgTSM9LfJjkbYD6F P+7R5oOzN7jg4dj9n8xwFq+LBGs7qSgrnxwcweXl4KmWMcCeZ96i0RNzQDS1ASKYQd NO+is1dbTYZhE4DbFcvRA73IsFaKy34m822KGOIZZx9icELvbiSV9mqHCHIyTFj9mu jsuwt2DqQ7UfA== Message-ID: <59852986-8988-4eaf-d88d-953d6c0b9f43@bastelstu.be> Date: Fri, 17 Jun 2022 20:13:08 +0200 MIME-Version: 1.0 Content-Language: en-US To: Go Kudo , internals@lists.php.net References: <77a64074-875c-cfd6-5811-24b9d445f550@bastelstu.be> <3aac541e-b80d-1106-369f-a00a3a718f90@bastelstu.be> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] Random Extension 5.x From: tim@bastelstu.be (=?UTF-8?Q?Tim_D=c3=bcsterhus?=) Hi On 6/17/22 19:46, Go Kudo wrote: > I was fundamentally wrong, I understand now. > As you said, there was no interoperability with `pickArrayKey()` 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. Yes, 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üsterhus