Re: [PATCH] Making in_array a language operator
| From: | Johannes Schlüter | Date: | Sun, 13 Nov 2011 02:10:16 +0000 |
| Subject: | Re: [PATCH] Making in_array a language operator | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-56307@lists.php.net to get a copy of this message | ||
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