Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109700 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 57214 invoked from network); 17 Apr 2020 23:04:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 17 Apr 2020 23:04:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 04ED71804C3 for ; Fri, 17 Apr 2020 14:34:52 -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=0.8 required=5.0 tests=BAYES_50,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE autolearn=no autolearn_force=no version=3.4.2 X-Spam-ASN: AS46606 74.220.192.0/19 X-Spam-Virus: No X-Envelope-From: Received: from gateway3.unifiedlayer.com (gateway3.unifiedlayer.com [74.220.193.105]) (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 Apr 2020 14:34:51 -0700 (PDT) Received: from cm3.websitewelcome.com (unknown [108.167.139.23]) by gateway3.unifiedlayer.com (Postfix) with ESMTP id 4D4C4200A3B46 for ; Fri, 17 Apr 2020 16:34:50 -0500 (CDT) Received: from krieger.asoshared.com ([65.99.237.153]) by cmsmtp with ESMTP id PYdNjFru3KgzSPYdOjylfQ; Fri, 17 Apr 2020 16:34:50 -0500 X-Authority-Reason: nr=8 Received: from krieger.asoshared.com ([65.99.237.153]:51909) by krieger.asoshared.com with esmtpa (Exim 4.91) (envelope-from ) id 1jPYdN-000RaU-Sw for internals@lists.php.net; Fri, 17 Apr 2020 16:34:49 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 17 Apr 2020 16:34:49 -0500 To: PHP internals In-Reply-To: References: <366565615b320e2f6b0a2d75298d84e7@wkhudgins.info> Message-ID: <610a6846b5fa9d3e46af16559b465d41@wkhudgins.info> X-Sender: will@wkhudgins.info User-Agent: Roundcube Webmail/1.3.3 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - krieger.asoshared.com X-AntiAbuse: Original Domain - lists.php.net X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - wkhudgins.info X-BWhitelist: no X-Source-IP: 65.99.237.153 X-Source-L: Yes X-Exim-ID: 1jPYdN-000RaU-Sw X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: krieger.asoshared.com [65.99.237.153]:51909 X-Source-Auth: will@wkhudgins.info X-Email-Count: 2 X-Source-Cap: d2todWRnaW47d2todWRnaW47a3JpZWdlci5hc29zaGFyZWQuY29t X-Local-Domain: yes Subject: Re: [PHP-DEV] RFC Raised for str_starts_with and str_ends_with From: will@wkhudgins.info On 2020-04-05 21:23, will@wkhudgins.info wrote: > On 2020-03-26 04:19, Guilliam Xavier wrote: >> On Thu, Mar 26, 2020 at 9:54 AM Nikita Popov >> wrote: >>> >>> On Thu, Mar 26, 2020 at 3:36 AM wrote: >>> >>> > Hi, >>> > >>> > Hope everyone is doing alright. I just raised a new RFC >>> > (https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions , >>> > github patch: https://github.com/php/php-src/pull/5300) for adding >>> > str_starts_with and str_ends_with to PHP. I would like to open this RFC >>> > up to discussion. >>> > >>> > I raised a similar RFC about 9 months ago >>> > (https://wiki.php.net/rfc/add_str_begin_and_end_functions) that was >>> > narrowly rejected. A major criticism of that RFC was the inclusion of >>> > case-insensitive versions of str_starts_with and str_ends_with. I have >>> > incorporated feedback from that experienced and narrowed the new RFC to >>> > only propose str_starts_with and str_ends_with. >>> > >>> >>> I was in favor of the previous RFC, so also in favor of this one :) >>> These >>> are going to complement the recently added str_contains() nicely. >>> >>> Notes on text: >>> >>> > After that RFC was closed, a code freeze was in place for PHP8's release. >>> PHP8 has now been released and several individuals have requested the >>> str_starts_with and str_ends_with functionality again. This is a >>> simple but >>> highly desired functionality for PHP. >>> >>> I think you mean PHP 7.4 here. PHP 8.0 is not yet released, and not >>> in >>> feature freeze either. >>> >>> > Add str_starts_with, and str_starts_with_ci() functions >>> >>> The second function should probably be str_ends_with() :) >>> >>> Nikita >> >> Hi Will, >> >> First, thank you for re-working on this, I would love to see it >> happen! :) >> >> Nevertheless, apart from some typos (already reported), I still think >> the RFC needs a "Motivation" section with actual examples of userland >> implementations (using functions like >> str[r]pos/strncmp/substr[_compare]... often with strlen, or even >> preg_match/fnmatch... [with escaping]) and the downsides of each (e.g. >> CPU-inefficient, memory-inefficient, error-prone, hard to >> understand...) plus how they handle empty strings. >> >> (And also probably shorten the introduction ^^ or move parts into a >> new subsection) >> >> PS: you could also add a link to the str_contains RFC >> >> Best regards, > Hello, > > I have revised the RFC, > https://wiki.php.net/rfc/add_str_starts_with_and_ends_with_functions , > based on feedback from Nikita and Guilliam (thank you). > > Please review the revised RFC and share any feedback during the coming > days. > > Thank you, > > Will I will be moving this RFC to a vote on Monday April 20, 2020. I will send out another email with the [VOTE] tag on that date when I update the RFC to include the voting macro. Thanks, Will