Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:109543 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 84472 invoked from network); 6 Apr 2020 03:56:21 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 6 Apr 2020 03:56:21 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id E34781804C4 for ; Sun, 5 Apr 2020 19:23:54 -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 gateway1.unifiedlayer.com (gateway1.unifiedlayer.com [74.220.221.221]) (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 ; Sun, 5 Apr 2020 19:23:54 -0700 (PDT) Received: from cm4.websitewelcome.com (unknown [108.167.139.16]) by gateway1.unifiedlayer.com (Postfix) with ESMTP id 421AF20078E81 for ; Sun, 5 Apr 2020 21:23:53 -0500 (CDT) Received: from krieger.asoshared.com ([65.99.237.153]) by cmsmtp with ESMTP id LHQXjxWkADhm0LHQXjGviY; Sun, 05 Apr 2020 21:23:53 -0500 X-Authority-Reason: nr=8 Received: from krieger.asoshared.com ([65.99.237.153]:29499) by krieger.asoshared.com with esmtpa (Exim 4.91) (envelope-from ) id 1jLHQW-002QJe-U7; Sun, 05 Apr 2020 21:23:52 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Sun, 05 Apr 2020 21:23:52 -0500 To: Guilliam Xavier Cc: Nikita Popov , PHP internals In-Reply-To: References: <366565615b320e2f6b0a2d75298d84e7@wkhudgins.info> Message-ID: 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: 1jLHQW-002QJe-U7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: krieger.asoshared.com [65.99.237.153]:29499 X-Source-Auth: will@wkhudgins.info X-Email-Count: 1 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-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