Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:51766 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 90929 invoked from network); 31 Mar 2011 14:52:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2011 14:52:45 -0000 Authentication-Results: pb1.pair.com header.from=tyra3l@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=tyra3l@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: tyra3l@gmail.com X-Host-Fingerprint: 209.85.210.170 mail-iy0-f170.google.com Received: from [209.85.210.170] ([209.85.210.170:53779] helo=mail-iy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 39/63-04048-B35949D4 for ; Thu, 31 Mar 2011 09:52:44 -0500 Received: by iyb12 with SMTP id 12so2813683iyb.29 for ; Thu, 31 Mar 2011 07:52:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=GoRBhdaqIUiVFrqRkeu5aYvQj33jbx7viGDZqLwzLMc=; b=ZKRnqtvBD4NulTFQzbDlVwVsA8GRySTqIF/ej2BZTpx/v+DLCuA9fQGdfZgpxdeFZW HTMHOOAetA9l2sVmXBqBEfdrUUlOqHFgdBTf2jQlpTjYZZk0HHT8KIjDUiP//WjCDpIA zfDA3BiFQ+JdAab3ljwBolf9OIZAMkMK8cS4o= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; b=LHosu3ugJhekzGDb4uN2Gcug0fpHLjMnGcm23nkbBU1ufWoUdqIeVXnbzChPlQSSp1 TG/SN6nyiv6BVYFXWlDl49uBe4BzmEBBbloKPv5Tm0W0E6x0KUTm0sjWPfEYDfCqIPfQ WlTdyGxb8jSYraCE1PtUorIyuYCOepe4IzJxE= MIME-Version: 1.0 Received: by 10.231.94.138 with SMTP id z10mr2629852ibm.105.1301583161138; Thu, 31 Mar 2011 07:52:41 -0700 (PDT) Sender: tyra3l@gmail.com Received: by 10.231.15.204 with HTTP; Thu, 31 Mar 2011 07:52:40 -0700 (PDT) In-Reply-To: <4D94948E.5000901@divbyzero.net> References: <4D92CC38.5040900@toolpark.com> <004301cbeee8$e54a8280$afdf8780$@com> <4D9387BE.4030808@divbyzero.net> <4D94948E.5000901@divbyzero.net> Date: Thu, 31 Mar 2011 16:52:40 +0200 X-Google-Sender-Auth: LQoW63KOJUNsiTYaat-erbWNb-o Message-ID: To: Martin Jansen Cc: Philip Olson , Dan Birken , internals@lists.php.net Content-Type: multipart/alternative; boundary=bcaec5430d8af72150049fc871fe Subject: Re: [PHP-DEV] Adding a more logical string slicing function to PHP From: info@tyrael.hu (Ferenc Kovacs) --bcaec5430d8af72150049fc871fe Content-Type: text/plain; charset=UTF-8 On Thu, Mar 31, 2011 at 4:49 PM, Martin Jansen wrote: > On 31.03.11 16:41, Philip Olson wrote: > > On Mar 30, 2011, at 1:42 PM, Martin Jansen wrote: > >> Both str_startswith and str_endswith have been suggested in the past: > >> > >> http://marc.info/?t=121647230100001&r=1&w=2 > >> > >> I recently got around to merge them into a largely unfinished extension > >> so they are archived somewhere safe: https://github.com/mj/php-ext-str > > > > I see str_contains() on the TODO there. I've always wanted in_string() so > am glad to see a similar item. Using strpos() for this task feels dirty, > much like using arrpos() for arrays would ;) > > >From time to time I have wondered if it made sense to add a new operator > "in" that works on variables of different type and could replace > in_string/str_contains: > > if ("a" in "abc") { ... } > > if ("a" in array("a", "b", "c")) { ... } > > if ("a" in $obj) { /* true if $obj->__contains("a") returned true */ } > > I suspect there is a massive potential for WTF issues in there and that > most people would hate this feature. Which is why I am only thinking > out loud here -- I have zero intentions to suggest this as a future > enhancement for PHP. ;-) > > - Martin > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > would we have mb_in also? :) Tyrael --bcaec5430d8af72150049fc871fe--