Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:106179 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 73989 invoked from network); 8 Jul 2019 19:33:26 -0000 Received: from unknown (HELO mail-wr1-f45.google.com) (209.85.221.45) by pb1.pair.com with SMTP; 8 Jul 2019 19:33:26 -0000 Received: by mail-wr1-f45.google.com with SMTP id z1so13292691wru.13 for ; Mon, 08 Jul 2019 09:52:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=NVjvUW3luSMzxOSfzAqYo/fs+kLAqdfYJJxOyFZBFaM=; b=TmOLi4vH5n+l2/gksE3i0brl6Xeskjj4fmB5/r6nVNlN9M0Q8z3jgoPTcoLfmMEBiU I9DzVkPXJRMLjSDVMtUs8QyrZZr6Gw7yiOht8r9tf605DnKN/nPJsyeuISgmmCfQisxZ OhX7vpZpfQRXh0tZqhQUwLcWth+M6m1ArCY/U= 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:content-transfer-encoding; bh=NVjvUW3luSMzxOSfzAqYo/fs+kLAqdfYJJxOyFZBFaM=; b=OigxS3tW9tZEBjOAL2zn+vyjCUJ7gHM/sTh0xVWgCcp4ZHXX0bPLGI995A5SkwoPqP lykAr2eKDYeJOV2XREh0KI521Gt5XqsA1rbIC5xELFRj7sRAcyENLvZxyqJc23C/YDqj sX2i0lht/taq0D6ewgsrS1HrkTsiEv83uZAWXaflDs1yNhQlBJ8m7yYAnsGSpGaEyvkg iSsDdLznLmSVDpdQb49M3oXRtiyQPW1nj/JScNF7Dh6fgkPwoLMNrI6IPE6KUFYS9sdK uK1KT4vOflKW9l/R32Lk2r4kSvJo4LwwBGJZt0KgbaPHdrJPy2PuufROJfXgxyKhnA6q 96Lw== X-Gm-Message-State: APjAAAV6+327ad1H69F73N8ZWHgujWA7iM5xf7ZC2eoJ9qLsQ8ZqtaGL bGdcvcY34mHUZ0ybpQkP8clTABvlhrRX+f3EWSEVHA== X-Google-Smtp-Source: APXvYqxYWRYQ/a6pM2MP3p1SqGJFmy4n0GbCKNNxP6xFuKRZbz79fE+V9vGvlgdiCxQsG4zwZQsiLsADBA4qHmsAjrg= X-Received: by 2002:adf:f046:: with SMTP id t6mr21060295wro.307.1562604772595; Mon, 08 Jul 2019 09:52:52 -0700 (PDT) MIME-Version: 1.0 References: <1562591120.659818.23020.47476@mail.rambler.ru> <7ff385f1-b86d-e56d-4133-e2f101afa13e@gmx.de> In-Reply-To: Date: Mon, 8 Jul 2019 19:52:41 +0300 Message-ID: To: Claude Pache Cc: "Christoph M. Becker" , Andrew Gromov , internals , Marco Pivetta Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] Re: [VOTE] Voting opens for str_starts_with and ends_with functions From: narf@devilix.net (Andrey Andreev) Hi, On Mon, Jul 8, 2019 at 4:54 PM Claude Pache wrote: > > > > Le 8 juil. 2019 =C3=A0 15:20, Christoph M. Becker a= =C3=A9crit : > > > > FTR, there is already substr_compare(). > > `substr_compare()` (as well as `strncmp()` which I am currently using in = lieu of `str_starts_with()`) forces you to provides the substring and the l= ength of the substring, instead of just the substring: > > substr_compare('foobarbaz', 'foo', 0, 3) =3D=3D=3D 0 > strncmp('foobarbaz', 'foo', 3) =3D=3D=3D 0 > str_starts_with('foobarbaz', 'foo') > The existence of substr_compare() and strncmp() is also my main motivation for voting No, though I also share Zeev's reasoning. You're right that the 2 already existing functions are a bit less convenient to use, but the RFC doesn't even try to make a case for that, so how do we know this was even considered? While I'm not against having more than one way of doing things, I do think we need a compelling enough reason to add a third way of doing the same thing and here we don't even have an attempt to convince us. Cheers, Andrey.