Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106164 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 98009 invoked from network); 8 Jul 2019 14:11:02 -0000 Received: from unknown (HELO mail-io1-f44.google.com) (209.85.166.44) by pb1.pair.com with SMTP; 8 Jul 2019 14:11:02 -0000 Received: by mail-io1-f44.google.com with SMTP id f4so18861542ioh.6 for ; Mon, 08 Jul 2019 04:30:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=B8RA8ewTMLvcU13+8MLb3h6V8btfIhHWdMUmbDWpjgA=; b=B98yCLRWziJc4/ivRvW2/KRKLxBvFKFDQFDB/itZKr+M71xU7LFc2nCGqCbZ33N45x RSnMG54DpTOEZAa2BgJQoM2kccHWLlNX0VHopVNcBu1QRTa9x2nzUrLtzGahtPjybnzf XqrEO8mzyQ+tz13qrQv27Aa+Fe+lr47DJsKdkMQeO4w+Gf0gIIGBOMdr6ZX1Z96zfbSW y7puxd5MxaJXi9bTq6sveAABldrEHuNGm+8HKX1t9Sl/VC92qgBqjHW7BW1OB91Z9Y0i IRiRKXMJiAOetCMN+jaV89krjB91ueUbO0M4Vnu8JC41cqhfbq2KVu/uR95NO05xx+cM BH0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=B8RA8ewTMLvcU13+8MLb3h6V8btfIhHWdMUmbDWpjgA=; b=DRy8/wapm1vQsnuQ95GNJ2/iBGilc+3WOiQQCDBD02hL+7IurBaihQ8xS++abf3341 wF8SXyxoqB50giQqxmPOLK/UMnxrpOLVS109DNE2xTXQocHMKeepNqwMBjiQe5HAOY0K HdiNt2aDtBDj916JF5VrBitrUf1z+0gnxIwSfVLPs6cC71kdlHKq+UQDoT72PH0JtjBO DHv/CyhTdv5jrkc7ugCJpoFUuO9aFLq2p4Yu+0C9HOFBFfJYez8VRIuoyoybC1qLxAk9 FdCYIBxXcaKeA9HdTCAlI5pG7sOEtTbWqK1cVveb/+PgdFyw94VBAWWmhR4RszdcTArs H2EA== X-Gm-Message-State: APjAAAVp+pjHfrudnMtoLt+5Td/i29ON8JRqVCoq38pHxPCJMUchO//s //7N+13luGK7cjlsKseWaQaDoBtuh2kcxK2S15s= X-Google-Smtp-Source: APXvYqznMlYoksH8IY9derVcr23+xdmgm2bjN17H+sv0aM9ZxPEdAuCSpoy/fmZi8XKspPALYCbJBkm7aAOACozis8w= X-Received: by 2002:a5e:d80d:: with SMTP id l13mr17888830iok.292.1562585425071; Mon, 08 Jul 2019 04:30:25 -0700 (PDT) MIME-Version: 1.0 References: <1562580929.565898.27487.49640@mail.rambler.ru> In-Reply-To: <1562580929.565898.27487.49640@mail.rambler.ru> Date: Mon, 8 Jul 2019 13:30:12 +0200 Message-ID: To: Andrew Gromov Cc: PHP Internals List , Theodore Brown Content-Type: multipart/alternative; boundary="0000000000003154bb058d29c560" Subject: Re: [PHP-DEV] Re: [VOTE] Voting opens for str_starts_with and ends_with functions From: ocramius@gmail.com (Marco Pivetta) --0000000000003154bb058d29c560 Content-Type: text/plain; charset="UTF-8" On Mon, Jul 8, 2019, 12:15 Andrew Gromov wrote: > > For those voting against adding these functions, can you clarify why? > > Do you dislike how they are named, or do you not see the need for the > > case insensitive versions, or is there an issue with the implementation? > > > I believe that star_with/end_with is useful, but not in this form. > The standard library has 98 string functions with different naming styles. > Adding 4 more (8 for mb_) functions for actually two(one?) tasks is > redundant. > > I think that more discussion is needed. > > My preferred variants: > > 1) One function > > ```php > str_contains( > $haystack, > $needle, > [CASE_INSENSITIVE|FROM_BEGIN|FROM_END|MULTI_BYTE] = 0, > [$encoding] = utf8 > ) > ``` > > 2)Or two > > ```php > str_starts_with(...see above, but without FROM_BEGIN|FROM_END) > str_ends_with(...see above, but without FROM_BEGIN|FROM_END) > ``` > > Best regards,Andrey > Please don't switch behaviours via flags: separate names and implementations are much clearer and much simpler to follow. Yes, you will have multiple variations, but that's fine. > --0000000000003154bb058d29c560--