Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:56307 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 46954 invoked from network); 13 Nov 2011 02:10:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 13 Nov 2011 02:10:23 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.211.66 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.211.66 config.schlueters.de Received: from [217.114.211.66] ([217.114.211.66:46381] helo=config.schlueters.de) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BC/95-11501-D072FBE4 for ; Sat, 12 Nov 2011 21:10:22 -0500 Received: from [192.168.2.230] (ppp-93-104-41-87.dynamic.mnet-online.de [93.104.41.87]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by config.schlueters.de (Postfix) with ESMTPSA id 9550B78587; Sun, 13 Nov 2011 03:10:17 +0100 (CET) To: Antoine Delignat-Lavaud Cc: internals@lists.php.net In-Reply-To: <4EBF1F70.5090700@ens-cachan.fr> References: <4EBF1F70.5090700@ens-cachan.fr> Content-Type: text/plain; charset="UTF-8" Date: Sun, 13 Nov 2011 03:10:16 +0100 Message-ID: <1321150216.1766.6.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] Making in_array a language operator From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) Hi, On Sun, 2011-11-13 at 02:37 +0100, Antoine Delignat-Lavaud wrote: > > if(($v1=="a1" || $v=="a2" || ...) && ($v2=="b1" || $v2=="b2" ||...) > && ...) This could also be written as if (in_array($v1, ["a1", "a2", ...]) && in_array($v2m ["b1", "b2", ...])) > by replacing them with: > > if($v1 in ["a1","a2",...] && $v2 in ["b1","b2",...]) I would certainly not add it to 5.4. For 5.5 I also have doubts whether it's worth the additional keyword and opcode. Yes it will, most likely, but this is an extension to the grammar ... johannes