Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84810 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49810 invoked from network); 15 Mar 2015 09:18:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 15 Mar 2015 09:18:20 -0000 Authentication-Results: pb1.pair.com header.from=me@kelunik.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=me@kelunik.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain kelunik.com from 81.169.146.218 cause and error) X-PHP-List-Original-Sender: me@kelunik.com X-Host-Fingerprint: 81.169.146.218 mo4-p00-ob.smtp.rzone.de Received: from [81.169.146.218] ([81.169.146.218:19448] helo=mo4-p00-ob.smtp.rzone.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7B/13-29489-95E45055 for ; Sun, 15 Mar 2015 04:18:19 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1426411094; l=1492; s=domk; d=kelunik.com; h=Content-Type:Cc:To:From:Subject:Date:References:In-Reply-To: MIME-Version; bh=JlFLMZzAd7yJTMdzk/ImXx3NtafdiGRAdvur5Ln/xqk=; b=TSYbwMIbf0ZvLiz1v4na9PDtSN4F96bBt2DgqxGMD1RsuQjPc8vr4GgQ3tJig9PbFVH C2I2G/kGyWKiFRcOgZqyCA5O39ysAiBrhHYbd6rzSqxufxcp9nfUTEPQ8xarV+sixtk/t HH8etK6D0sgF4F9XbxxU3EgmZ78Wc9Iubwg= X-RZG-AUTH: :IWkkfkWkbvHsXQGmRYmUo9mls2vWuiu+7SLDup6E67mzuoNNBqD/uc8= X-RZG-CLASS-ID: mo00 Received: from mail-wi0-f179.google.com ([209.85.212.179]) by smtp.strato.de (RZmta 37.4 AUTH) with ESMTPSA id 202771r2F9IELO2 (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) for ; Sun, 15 Mar 2015 10:18:14 +0100 (CET) Received: by wibg7 with SMTP id g7so14173506wib.1 for ; Sun, 15 Mar 2015 02:18:14 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.60.19 with SMTP id d19mr113657072wjr.133.1426411094139; Sun, 15 Mar 2015 02:18:14 -0700 (PDT) Received: by 10.27.222.1 with HTTP; Sun, 15 Mar 2015 02:18:14 -0700 (PDT) In-Reply-To: <5504EF9D.1000707@gmail.com> References: <5504EF9D.1000707@gmail.com> Date: Sun, 15 Mar 2015 10:18:14 +0100 Message-ID: To: Stanislav Malyshev Cc: PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] [RFC][PRE-VOTE] In Operator From: me@kelunik.com (Niklas Keller) 2015-03-15 3:34 GMT+01:00 Stanislav Malyshev : > Hi! > >> I'd like to announce that I'll open the vote for the in operator later that day. >> You can find the RFC here: https://wiki.php.net/rfc/in_operator > > I think this operator is unnecessary - we already have perfectly good > function that does the same. If they were "perfectly good", ... > Also, since it checks the values and not > the keys, it would be useless for the same use case one would most > frequently use "in" in Python and such - for checking if something is in > a set of values. Since efficient implementation of the set in PHP would > have the value being sought as key, "in" would be useless, unless much > slower iterative implementation is chosen. We already have a language construct here that's not a function call: isset. > Also, because it includes different (and inconsistent) implementation > for strings, if you have ("foo" in $bar === true) , you don't know if > $bar is an array that includes string "foo" or a string that has "foo" > as a substring. I don't think it's good that operator would mix these > two cases. It's different for strings, yes, but where's the inconsistency? A common user case would probably be checking user input against a set of values. As others already mentioned in the discussion there have been security issues using non-strict in_array in the past. > -- > Stas Malyshev > smalyshev@gmail.com Regards, Niklas