Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:117992 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 68490 invoked from network); 17 Jun 2022 16:49:23 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Jun 2022 16:49:23 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id F29E5180538 for ; Fri, 17 Jun 2022 11:37:39 -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,HTML_MESSAGE,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS15169 209.85.128.0/17 X-Spam-Virus: No X-Envelope-From: Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Fri, 17 Jun 2022 11:37:39 -0700 (PDT) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-3137316bb69so50187867b3.10 for ; Fri, 17 Jun 2022 11:37:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=colopl.co.jp; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=jli7dLzM9yceoTXBNbUZx4uWhKWf3hWrOp+yCblAGJ0=; b=BRRuJEzaleNJEChw4D9LRhVHGZ4up9UIylMFEDCd1NHkh4KG8evk+sjofgdn0k3xjM pfm/lG3fbQf0s8c3OnG18Jz5l7TfX/4HK3dDb6oW0WXrsMoe8JTmr4t3V6BDVi4d96TU P3DA0glovHY/NCiI7vgvUxq7xsjQw+cXglzfZBDsKLcACM8FcaSaop2xHlDWCa3JAVec ZbdIeqAqkjnWm9lgHMv9n1UN2Gqpfb93RXpppmUhPdXASpfMo7c/BvPZAvA1tg9TxlK3 B6gS/GdWIccwksGkYiLksAKjwLXHyEwWdJV1kUeKLxtTHa4wjmABYivPwS7YUSoiSKCY AEzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=jli7dLzM9yceoTXBNbUZx4uWhKWf3hWrOp+yCblAGJ0=; b=LRKtpRjbEvCOo1noA/gTibhfZHyE/T3NPc8Y9I9BB3uo96MdLBIGyiSwryQtzrONJj 1KE48899nwsn0fusUxumk9attKW1Sw0t6aPKRvvP0q/ZaNr3Et8JFK07lWhMLpO1HYbs EM2Vkmg7pfRgpRVx1IsZkZfHd6hnKrlXTUmFDEHHpTs6uVEcf36FpQt7HThr72mpvMPG 94QC5VCD6muwFWcAr9EdM80AaRCzNMemHTjAxkXCsu/CwjtMNIxaONd0qA56UzMDWDDv o2sjFWsxxH4WQr7ETdthFsFk/ELJ3ih9yus7w9oc+IOIScSzLdBK+fSgnVvkMjH2LwLB fKAw== X-Gm-Message-State: AJIora/3x16g5vbxd8lqxh/3MVd/ojqwrpgzuShBJ1MCqXOWN5KSDBpF AoWSJo4sZ5HHhJe6zFg6zP3+eNAxQyJLKu0Q2qUMTHzG72lW X-Google-Smtp-Source: AGRyM1sWUJxPhsW9IrSwkdD+zB+Esu0P4UKY6dCJzp2YV+1/jr1Wt9Td78guop5LnaDSd2DeP62oAcAkv0aISsbxJWk= X-Received: by 2002:a81:1790:0:b0:317:9429:e88f with SMTP id 138-20020a811790000000b003179429e88fmr163204ywx.150.1655491058918; Fri, 17 Jun 2022 11:37:38 -0700 (PDT) MIME-Version: 1.0 References: <77a64074-875c-cfd6-5811-24b9d445f550@bastelstu.be> <3aac541e-b80d-1106-369f-a00a3a718f90@bastelstu.be> <59852986-8988-4eaf-d88d-953d6c0b9f43@bastelstu.be> In-Reply-To: <59852986-8988-4eaf-d88d-953d6c0b9f43@bastelstu.be> Date: Sat, 18 Jun 2022 03:37:28 +0900 Message-ID: To: =?UTF-8?Q?Tim_D=C3=BCsterhus?= , internals@lists.php.net Content-Type: multipart/alternative; boundary="0000000000007eff2805e1a90c22" Subject: Re: [PHP-DEV] Re: [RFC] [VOTE] Random Extension 5.x From: g-kudo@colopl.co.jp (Go Kudo) --0000000000007eff2805e1a90c22 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 2022=E5=B9=B46=E6=9C=8818=E6=97=A5(=E5=9C=9F) 3:13 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=C3=BCsterhus > I noticed one important thing. "String" in PHP means binary, and operating on multibyte characters often causes problems. Although I rarely deal with multibyte characters in my work, this can probably be a big problem for Japanese PHP users like myself. To work around this, the mbstring extension must be used properly, but since mbstring is not built-in, it is appropriate to implement it in userland. For the reasons stated above, we will abandon the addition of new methods. sorry. `str_shuffle()` and `shuffleString()` already have similar problems. So perhaps an alternative method name for `str_shuffle()` might be `bytesShuffle()` instead of `stringShuffle()`. Regards Go Kudo --0000000000007eff2805e1a90c22--