Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83314 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 31832 invoked from network); 20 Feb 2015 15:55:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Feb 2015 15:55:19 -0000 Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:57324] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/A2-14173-3E857E45 for ; Fri, 20 Feb 2015 10:55:17 -0500 Received: by mail.experimentalworks.net (Postfix, from userid 1003) id E15D449250; Fri, 20 Feb 2015 16:55:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on km31408.keymachine.de X-Spam-Level: * X-Spam-Status: No, score=1.4 required=3.0 tests=ALL_TRUSTED, DNS_FROM_AHBL_RHSBL autolearn=no version=3.3.2 X-Spam-HAM-Report: * 2.4 DNS_FROM_AHBL_RHSBL RBL: Envelope sender listed in dnsbl.ahbl.org * -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP Received: from [192.168.2.34] (ppp-93-104-11-179.dynamic.mnet-online.de [93.104.11.179]) (using TLSv1.2 with cipher DHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id 86F2C49250; Fri, 20 Feb 2015 16:55:42 +0100 (CET) Message-ID: <1424447709.16516.2.camel@kuechenschabe> To: Niklas Keller Cc: PHP Internals Date: Fri, 20 Feb 2015 16:55:09 +0100 In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC][Discussion] In Operator From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Fri, 2015-02-20 at 13:54 +0100, Niklas Keller wrote: > Hi internals, > > "In Operator" is now in discussion phase. > > > This RFC adds a new in operator which simplifies contains checks for strings and arrays. > > Currently, we have to usein_array($needle, $haystack, true) or strpos($haystack, $needle) !== false. > > These functions have a inconsistent parameter order, so it's hard to remember which is the right one > > for each. The in operator makes these checks way more readable. Additionally, it also works for Traversable. > > https://wiki.php.net/rfc/in_operator | It uses strict comparison (===) for array values / instances of | Traversable This might be nice but is inconsistent with other parts of the language like switch statements. I think inconsistency is worse than this inconvenience. johannes