Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 64777 invoked from network); 27 Jul 2016 11:54:13 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Jul 2016 11:54:13 -0000 Authentication-Results: pb1.pair.com header.from=michal@brzuchalski.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=michal@brzuchalski.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain brzuchalski.com designates 188.165.245.118 as permitted sender) X-PHP-List-Original-Sender: michal@brzuchalski.com X-Host-Fingerprint: 188.165.245.118 ns220893.ip-188-165-245.eu Received: from [188.165.245.118] ([188.165.245.118:43034] helo=poczta.brzuchalski.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 74/B1-53289-7D0A8975 for ; Wed, 27 Jul 2016 07:54:00 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by poczta.brzuchalski.com (Postfix) with ESMTP id C6BCC2984236 for ; Wed, 27 Jul 2016 13:53:56 +0200 (CEST) Received: from poczta.brzuchalski.com ([127.0.0.1]) by localhost (poczta.brzuchalski.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id iqOc1tY_GpfS for ; Wed, 27 Jul 2016 13:53:55 +0200 (CEST) Received: from mail-qk0-f181.google.com (unknown [209.85.220.181]) by poczta.brzuchalski.com (Postfix) with ESMTPSA id 966D92984237 for ; Wed, 27 Jul 2016 13:53:51 +0200 (CEST) Received: by mail-qk0-f181.google.com with SMTP id x1so31468422qkb.3 for ; Wed, 27 Jul 2016 04:53:51 -0700 (PDT) X-Gm-Message-State: AEkoout7ZYXSh/dkKTzYpJMkpGpmw6TRx+irgt4Q7vhQabzRx9fW+8JWTLnEfOOY1c1VqyAM4rJLosbZ7LSWlA== X-Received: by 10.55.25.196 with SMTP id 65mr1197983qkz.27.1469620430835; Wed, 27 Jul 2016 04:53:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.237.53.155 with HTTP; Wed, 27 Jul 2016 04:53:50 -0700 (PDT) In-Reply-To: References: <2a035597d443afb282e374aead55319d@wkhudgins.info> <99c50f35968001e99765a0c760e2b906@wkhudgins.info> Date: Wed, 27 Jul 2016 13:53:50 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Christoph Becker Cc: Davey Shafik , will@wkhudgins.info, David Rodrigues , PHP Internals Content-Type: multipart/alternative; boundary=001a1147eb44bc38cc05389cab1f Subject: Re: [PHP-DEV] RFC Karma Request From: michal@brzuchalski.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --001a1147eb44bc38cc05389cab1f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2016-07-27 12:24 GMT+02:00 Christoph Becker : > On 27.07.2016 at 02:55, Davey Shafik wrote: > > > Ah, I missed that. If we had ranges (e.g. $string[0..4] or > $string[-1..4]) > > that'd work, but we don't. > > However, that still would require something like > > $str[0..mb_strlen($needle)-1] =3D=3D $needle > I've been working on range operator some time ago and had problem with double-dot ".." as an operator because of conflict with concat operator. 0..5 could be 0. . 5, or 0 . .5 white spaces are problem here, unfortunately dot is concat operator and decimal separator. > > > Now I see some value in the function, though still perhaps not enough t= o > > justify above and beyond strpos etc. > > One advantage of the new functions over userland implementations would > be efficiency. A strpos() would still require to search the whole > string if the $needle is not found. substr() and string slices would > require a copy unless that would be optimized, if a general optimization > is possible at all. > > Not sure, if I like to see yet two more string functions in the global > namespace, though. > > -- > Christoph M. Becker > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 pozdrawiam -- Micha=C5=82 Brzuchalski --001a1147eb44bc38cc05389cab1f--